var ie = document.all;
var nn6 = document.getElementById &&! document.all;

var isdrag = false;
var x, y;
var dobj;

function AjaxPost(TargetFile,PostId,ResponseId,DoSubmit) {
    var xmlHttpReq = false;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
       xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
	       xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }

   xmlHttpReq.open('POST', TargetFile, true);
   xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
   xmlHttpReq.onreadystatechange = function() {
        if (xmlHttpReq.readyState == 4) {
              
			  //document.getElementById(ResponseId).innerHTML = xmlHttpReq.responseText;
			    var newdiv = document.createElement("div");
				newdiv.innerHTML = xmlHttpReq.responseText;
				var container = document.getElementById(ResponseId);
				//container.appendChild(newdiv);
				container = newdiv;
			  if (DoSubmit)
			    document.thesearchform.submit();
				
        }
    }
    xmlHttpReq.send(PostId + '=' + document.getElementById(PostId).value); //Something=blah&something2=blah2
	
}
//menu fix
startList = function() { 
var allelements = document.getElementsByTagName("ul");
  for(var counter = 0;counter<allelements.length;counter++)
  {
    if (allelements[counter].className=="menu" || allelements[counter].className=="level1" || allelements[counter].className=="subMenu")
       fix(allelements[counter]);
  }
 
} // end startlist

function fix(navRoot) {
if (document.all&&document.getElementById) {
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI" && node.className!="spacer") {
	node.onmouseover=function() { this.className="over";  }
    node.onmouseout=function() { this.className=this.className.replace("over", "");  }
   } // end id LI
  } //end for
 } //end if
} // end function
window.onload=startList;

//Change level of subscription  
function HomePreload(imagefilenames) {
 	var args = imagefilenames.split(',');
	var animage = new Image();
	var images = [];
	for(var i=0; i<args.length; i++) {
	    animage.src = "./images/" + args[i];
	    images.push(animage);
	    
	}
 }

function ChangeLevel()
{

  var TheElement = document.getElementById('numberofusers');
  var TheIndustry = document.getElementById('industry');
  TheElement.disabled=false;
  if (!TheIndustry.value.indexOf("CMO") || !TheIndustry.value.indexOf("CRO"))
   {
    
    TheElement.options[0].text="1-10";
    TheElement.options[1].text="10-20";
    TheElement.options[2].text="20+";

  }
  else
  {
    TheElement.options[0].text="1-3";
    TheElement.options[1].text="3-10";
    TheElement.options[2].text="10+";

   }
 }
 //Show Hide
  function showhide(parentId,theId)
  {
    var theElement = document.getElementById(theId);
	var theParent = document.getElementById(parentId);
	if (theElement.style.display=="none")
	 { 
	  theParent.innerHTML=" <img src=\"/images/graphics/minus_icon.png\" border=\"0\" align=\"texttop\">";
	  theElement.style.display="block";
	 
	 }
	else
	{
	  theParent.innerHTML=" <img src=\"/images/graphics/plus_icon.png\" border=\"0\" align=\"texttop\">";
	 theElement.style.display="none";
	 }
  }
  function hide(theIds)
  {
    var theIdsArray = theIds.split(',');
	for (counter=0;counter<theIdsArray.length;counter++)
	{
	  var theElement = document.getElementById(theIdsArray[counter]);
      theElement.style.display = "none";
	}
  }
  
function hideall(theIds,theParents)
{
    var theIdsArray = theIds.split(',');
    for (counter=0;counter<theIdsArray.length;counter++)
	{
	    if (theIdsArray[counter].length>1) // keep javascript from blowing up
		{
		    var theElement = document.getElementById(theIdsArray[counter]);
		    theElement.style.display = "none";
		}
	}
    var theParentsArray = theParents.split(',');
    for (counter=0;counter<theParentsArray.length;counter++)
	{
	    if (theParentsArray[counter].length>1) // keep javascript from blowing up
		{
		    var theParent = document.getElementById(theParentsArray[counter]);
		    theParent.innerHTML=" <img src=\"../images/graphics/plus_icon.png\" border=\"0\" align=\"texttop\">";
		}
	}
}

function showall(theIds,theParents)
{
    var theIdsArray = theIds.split(',');
    for (counter=0;counter<theIdsArray.length;counter++)
	{
	    if (theIdsArray[counter].length>1)
		{
		    var theElement = document.getElementById(theIdsArray[counter]);
		    theElement.style.display = "block";
		}
	}
    var theParentsArray = theParents.split(',');
    for (counter=0;counter<theParentsArray.length;counter++)
	{
	    if (theParentsArray[counter].length>1) // keep javascript from blowing up
		{
		    var theParent = document.getElementById(theParentsArray[counter]);
		    theParent.innerHTML=" <img src=\"../images/graphics/minus_icon.png\" border=\"0\" align=\"texttop\">";
		}	
	}
}
