var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;

function show(sw,obj) {
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
	if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
	if (sw && ns4) document.layers[obj].visibility = 'visible';
	if (!sw && ns4) document.layers[obj].visibility = 'hidden';
}

function box(boxname,menustate){
    if (document.getElementById)
        {document.getElementById(boxname).style.visibility = menustate;}
    else {document[boxname].visibility = menustate;}
}

//toggle script found at http://www.safalra.com/programming/javascript/collapse.html
function toggle(image,list){
    var listElementStyle=document.getElementById(list).style;
	if (listElementStyle.display=="none")
	{
		listElementStyle.display="block";
		document.getElementById(image).src="images/but_minus.gif"; 
		document.getElementById(image).alt="Close list";
	}
	else
	{ 
		listElementStyle.display="none";
		document.getElementById(image).src="images/but_plus.gif"; 
		document.getElementById(image).alt="Open list";
	}
}

function mkLg(boxname,pxsize){
    
    document.getElementById(boxname).style.width = pxsize + "px";
        
}

function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}

function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}

function getpos(xdiv, xpos, ypos){
 
  e=document.getElementById(xdiv);
  e.style.left = xpos + 'px';
  e.style.top = ypos + 'px';
  
} 


// ****** fuction to make call to fill xmlHTTP *******/
var xmlHttp

function showUser(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="wrt_edit.php"
	url=url+"?q="+str
	document.getElementById("txtHint").style.visibility="visible";
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

var xmlHttp
function showDesc(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="res_soft_desc.php";
	url=url+"?soft="+str;
	document.getElementById("soft_desc").style.visibility="visible";
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

var xmlHttp
function showPDesc(str, CurOb)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="home_proj_desc.php";
	url=url+"?soft="+str;
	document.getElementById("proj_desc").style.visibility="visible";
	document.getElementById("proj_desc").style.top = findPosY(CurOb) - 80;
	
    var xpos = findPosX(CurOb) - 80;
    
	
    document.getElementById("proj_desc").style.left = xpos;
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged2 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


// ****** fuction to check when the readystate has been changed *******/
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("soft_desc").innerHTML=xmlHttp.responseText 
 } 
}

// ****** fuction to check which type of browser is used *******/
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

// ****** fuction to check when the readystate has been changed *******/
function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("proj_desc").innerHTML=xmlHttp.responseText 
 } 
}

// ****** fuction to check which type of browser is used *******/
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


