// JavaScript Document

	var enablepersist="on"; //Enable saving state of content structure using session cookies? (on/off)
	var collapseprevious="yes"; //Collapse previously open content when opening present? (yes/no)
	var 	ccollect=new Array();	
	if (document.getElementById){
		document.write('<style type="text/css">');
		document.write('.switchcontent{display:none;width:125px; }');
		document.write('</style>');
	}
		
	function getElementbyClass(classname){
	
		
		var inc=0;
		var alltags=document.all? document.all : document.getElementsByTagName("*");
		//alert(classname);
		for (i=0; i<alltags.length; i++){
			
			if (alltags[i].className==classname){
				ccollect[inc++]=alltags[i];
			}
		}
		//alert(inc);
		
	}

	function contractcontent(omit){
		var inc=0;
		//alert(omit);
		while (ccollect[inc]){
			if (ccollect[inc].id!=omit){
				
				ccollect[inc].style.display="none";
			}
			inc++;
		}
		
	}
	function contractcontent_sub(omit){
		var inc=0;
		//alert(omit);
		while (ccollect[inc]){
			if (ccollect[inc].id!=omit){
				
				//ccollect[inc].style.display="none";
			}
			inc++;
		}
		
	}
	
	
		
	function expandcontent(cid){
		//alert("exp  "+cid);
		//alert("hi");


	if (typeof ccollect!="undefined"){
			if (collapseprevious=="yes"){
				//alert("not");
				contractcontent(cid);
			}
          if(document.getElementById(cid)!=null)
		  {
		//alert(document.getElementById(cid).style.display);         
         if(document.getElementById(cid).style.display!="block") {
                   //alert("in if=="+cid); 
		  document.getElementById(cid).style.display="block";
           
         }
		  }
		 /* else
		    document.getElementById(cid).style.display="none";
			//document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none";
		//alert("set");	 */
		}

		
	}
	
		function expandcontent_sub(cid){
		//alert("exp  "+cid);
		//alert("hi2");


	if (typeof ccollect!="undefined"){
			if (collapseprevious=="yes"){
				//alert("not");
				contractcontent_sub(cid);
			}
          if(document.getElementById(cid)!=null)
		  {
		//alert(document.getElementById(cid).style.display);         
         if(document.getElementById(cid).style.display!="inline") {
                   //alert("in if=="+cid); 
		  document.getElementById(cid).style.display="inline";
           
         }
		  }
		 /* else
		    document.getElementById(cid).style.display="none";
			//document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none";
		//alert("set");	 */
		}

		
	}
		
	function revivecontent(){
		//alert("revivecontent");
		contractcontent("omitnothing");
		selectedItem=getselectedItem();
		selectedComponents=selectedItem.split("|");
		for (i=0; i<selectedComponents.length-1; i++){
			//alert(selectedComponents[i]);
			document.getElementById(selectedComponents[i]).style.display="block";

		}
	}
		
	function get_cookie(Name) { 
	//alert("get_cookies");
		var search = Name + "=";
		var returnvalue = "";
		if (document.cookie.length > 0) {
			offset = document.cookie.indexOf(search);
			if (offset != -1) { 
				offset += search.length;
				end = document.cookie.indexOf(";", offset);
				if (end == -1) end = document.cookie.length;
				returnvalue=unescape(document.cookie.substring(offset, end));
			}
		}
		return returnvalue;
	}
	
//refresh




//refresh



	function getselectedItem(){
		
		//alert("get");

	//alert("hist Item"+get_cookie('cookie_path'));
							// alert(window.location.pathname);

		if (get_cookie(window.location.pathname) != ""){
			selectedItem=get_cookie(window.location.pathname);
	//alert(selectedItem);
	//alert(window.location.pathname+"  select "+selectedItem);
			return selectedItem;
		}else{
			return "";
		} 
	}

	function saveswitchstate(){
		var inc=0, selectedItem="";
	
		while (ccollect[inc]){
			if (ccollect[inc].style.display=="block"){
				selectedItem+=ccollect[inc].id+"|";
			}
			inc++;
		}
		//alert("save");
	//alert(selectedItem);
	//alert(window.location.pathname+"  select "+selectedItem);

	document.cookie="cookie_path="+selectedItem;
	

		document.cookie=window.location.pathname+"="+selectedItem;

		//document.cookie=window+"="+selectedItem;

	}
		
	function do_onload(){
		getElementbyClass("switchcontent");
       
		if (enablepersist=="on" && typeof ccollect!="undefined"){
        
				revivecontent();
			
		}

	}
		
		
	if (window.addEventListener){
		//alert("hi1");
			
		window.addEventListener("load", do_onload, false);
		
	}else if (window.attachEvent){
		
		//window.attachEvent("onload", do_onload);
	}else if (document.getElementById){
		
		window.onload=do_onload;
	}

	if (enablepersist=="on" && document.getElementById){
		window.onunload=saveswitchstate;
	}

	function borderize(what,color){
		what.style.backgroundColor=color;
	}
			
	function borderize_on(e){
   // alert("in border on");
		if (document.all){
			source3=event.srcElement;
		}else if (document.getElementById){
			source3=e.target;
		}
		 if(source3!=null)
		 {
		if (source3.className=="navlinks"){
			borderize(source3,"#ffba00");
		}else{
			while(source3.tagName!="TABLE"){
             //alert( "source3 in on =="+source3)   
				source3=document.getElementById? source3.parentNode : source3.parentElement;
              if(source3!=null)
			  {
				if (source3.className=="navlinks"){
					borderize(source3,"#ffba00");
				}
			  }//if
			  else
			  {
				break;

			  }
			 
			} //wh
		}//else
		 }//if null
	}
			
	function borderize_off(e){
       // alert("in border off");   
		if (document.all){
			source4=event.srcElement;
		}else if (document.getElementById){
			source4=e.target;
		}
	
		if(source4!=null)
		{
			if (source4.className=="navlinks"){
			        borderize(source4,"");
			}
			else{
				while(source4.tagName!="TABLE"){
					
				//     alert( "source4 in off =="+source4)         
						source4=document.getElementById? source4.parentNode : source4.parentElement;
						if(source4!=null)
						{
								if (source4.className=="navlinks"){
								borderize(source4,"");
								}
						}//if
						else
						{
						      break;

						}
						
						
				} 
			}
		}//if
	}
        
			
	function MM_displayStatusMsg(msgStr)  { //v3.0
		status=msgStr; document.MM_returnValue = true;
	}
			
	function MM_findObj(n, d) { //v4.01
		var p,i,x;
		if(!d){
			d=document;
		}
		if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
		}
		if(!(x=d[n])&&d.all){
			x=d.all[n];
		}
		for (i=0;!x&&i<d.forms.length;i++){
			x=d.forms[i][n];
		}
		for(i=0;!x&&d.layers&&i<d.layers.length;i++){
			x=MM_findObj(n,d.layers[i].document);
		}
		if(!x && d.getElementById){
			x=d.getElementById(n);
		    {
		    return x;
	        }
        }
    }

	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments;
		document.MM_sr=new Array;
		for(i=0;i<(a.length-2);i+=3){
			if ((x=MM_findObj(a[i]))!=null){
				document.MM_sr[j++]=x;
			   	if(!x.oSrc){
					x.oSrc=x.src;
				}
			   	x.src=a[i+2];
			}
		}
	}

	function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr;
		for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){
			x.src=x.oSrc;
		}
	}
			
	function MM_preloadImages() { //v3.0
		var d=document;
		if(d.images){
			if(!d.MM_p){
				d.MM_p=new Array();
			}
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
			for(i=0; i<a.length; i++){
				if (a[i].indexOf("#")!=0){
				   	d.MM_p[j]=new Image;
				   	d.MM_p[j++].src=a[i];
				}
			}
		}
	} 
	
	
	
	//******************   newinnertmp ************************/
	
	function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length < 2) ? hrefString :  arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();                    
}
		function setActiveMenu(arr, crtPage)
{        
                   var flag;
                     flag=0;
//alert(crtPage);

	for (var i=0; i<arr.length; i++)
	{ // alert(extractPageName(arr[i].href));  

		if(extractPageName(arr[i].href) == crtPage)
		{
                 
var node=arr[i].parentNode.parentNode.parentNode;
if(node.tagName=='DIV')
{

// alert(node.id);
if(node.id=='sc1' || node.id=='sc2' || node.id=='sc3' ||node.id=='sc4' || node.id=='sc5' || node.id=='sc6')
{
     // document.getElementById(node.id).style.display="block";
//expandcontent(node.id);
}
}
                //  alert(arr[i].parentNode.parentNode.parentNode.tagName);
			if (arr[i].parentNode.tagName != "DIV")
			{//alert(arr[i].className);
                             //  alert("set current");
				arr[i].className = "current";
				arr[i].parentNode.className = "current";
			}
		}
	}

}



    	function setPage()
		{
   			 hrefString = document.location.href ? document.location.href : document.location;
   // alert(hrefString);

    		if (document.getElementById("nav_blk_lnk")!=null)
       			{
			
				 setActiveMenu(document.getElementById("nav_blk_lnk").getElementsByTagName("a"), extractPageName(hrefString));
				}

}
function navProduct()
{

document.getElementById("a2").className="current";
document.getElementById("a1").className="navlinks";

//document.getElementById("a3").className="navlinks";
document.getElementById("a4").className="navlinks";
document.getElementById("a5").className="navlinks";
document.getElementById("a6").className="navlinks";
document.getElementById("a7").className="navlinks";
document.getElementById("a8").className="navlinks";

}
  function navProduct_sub()
{

document.getElementById("a2").className="current";
document.getElementById("a23").className="current";
document.getElementById("a1").className="navlinks";

//document.getElementById("a3").className="navlinks";
document.getElementById("a4").className="navlinks";
document.getElementById("a5").className="navlinks";
document.getElementById("a6").className="navlinks";
document.getElementById("a7").className="navlinks";
document.getElementById("a8").className="navlinks";

}

//********************END newinnertmp *****************************/

//*******************More Information *****************************/


//phone number 


// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;


function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}


function checkInternationalPhone(strPhone){
var bracket=3;
strPhone=trim(strPhone);
if(strPhone.indexOf("+")>1) return false;
if(strPhone.indexOf("-")!=-1)bracket=bracket+1;
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false;
var brchr=strPhone.indexOf("(");
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false;
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false;
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
//domain/url
function checkURL(value) {
var RegExp =/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;

if(RegExp.test(value))
{
return(true);
}
return(false);
}


//checkmail
function checkemail(str){
var testresults;
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if (filter.test(str))
    testresults=true;
    else{
    
      testresults=false;
      }
      return (testresults);
}




 // Removes leading whitespaces
     function LTrim( value ) {
     	
   	var re = /\s*((\S+\s*)*)/;
    	return value.replace(re, "$1");
  	
 }
  
    // Removes ending whitespaces
    function RTrim( value ) {
   	
  	var re = /((\s*\S+)*)\s*/;
  	return value.replace(re, "$1");
   	
   }
  
  // Removes leading and ending whitespaces
  function trim( value ) {
   	
   	return LTrim(RTrim(value));
   	
   }
function validate_form(obj)
{
		if(trim(obj.org.value)=="")
		{
		alert("Please Enter Company Name");
		return false;
		}
		
		if(trim(obj.fname.value)=="")
		{
		alert("Please Enter First name");
		return false;
		}
		
		if(trim(obj.lname.value)=="")
		{
		alert("Please Enter Last name");
		return false;
		}
		
		if(trim(obj.email.value)=="")
		{
		alert("Please Enter Email");
		return false;
		}
		else
		{
		 if(!checkemail(obj.email.value))
		{
		alert("Please Enter Valid Email");
		return false;
		}
		}
		
		
		if(trim(obj.org_type.value)=="")
		{
		alert("Please Enter Organization Type");
		return false;
		}
		
		
		/*
		if(trim(obj.domain.value)=="")
		{
		alert("Please Enter Domain/URL to be used with Google Apps");
		return false;
		}
		else
		{
		if(!checkURL(obj.domain.value))
		{
		  alert("Please Enter Valid  Domain/URL to be used with Google Apps");
			return false;
		}
		}
		
		*/
		
		/*
		if(trim(obj.state.value)=="")
		{
		alert("Please Select State");
		return false;
		}*/
		
		if(trim(obj.country.value)=="")
		{
		alert("Please Select  Country");
		return false;
		}
		/*
		if(trim(obj.no_subscribe.value)=="")
		{
		alert("Please Select  Number of subscribers ");
		return false;
		}
		
		if(trim(obj.decision_time.value)=="")
		{
		alert("Please Select Decision time frame");
		return false;
		}
		*/
		var sel="";
		
		/*
		var selected = new Array();
		var mySelect = obj.check;
		while(mySelect.selectedIndex != -1)
		{
		   if(mySelect.selectedIndex != 0)
		   {
			  selected.push(mySelect.options[mySelect.selectedIndex].value);
		   }
		
		   mySelect.options[mySelect.selectedIndex].selected = false;
		}
		for(var i = 0; i < selected.length; i++)
		{
		  sel=sel+selected[i]+',';
		}*/
		
		for(var i=0; i < obj.check.length; i++){
		if(obj.check[i].checked)
		{
		
		sel+=obj.check[i].value + ',';
		}
		}
		
		
		obj.products_hidd.value=sel;
		
		
		if(trim(obj.phone.value)!="")
		{
		
		
		
					if (checkInternationalPhone(obj.phone.value)==false){
			alert("Please Enter a Valid Phone Number");
			obj.phone.value="";
			obj.phone.focus();
			return false;
				   }
		}

	return true;
	
}




/*****************sp-More Information *******************************/

	/*****************sp-More Information *******************************/

