<!-- 



function WinExec(url,name,x,y,z) 

{

	var posX = (screen.width/2)-(x/2);

	var posY = (screen.height/2)-(y/2);

	var winPref = "width=" + x + ",height=" + y

		+ ",innerWidth=" + x + ",innerHeight=" + y

		+ ",left=" + posX + ",top=" + posY

		+ ",screenX=" + posX + ",screenY=" + posY

		+ ",toolbar=" + z + ",location=0,directories=0,status=" + z

		+ ",menubar=" + z + ",scrollbars=1,resizable=0,width=" + x

		+ ",height=" + y;

	var remoteWin = null;     

	remoteWin = window.open(url,name,winPref);

	if (window.focus) 

	{         

		remoteWin.focus();     

	} 

}   

function thumbnail(url,name,x,y,z)
{
	var posX = 10;
	var posY = 10;
	var winPref = "width=" + x + ",height=" + y
		+ ",innerWidth=" + x + ",innerHeight=" + y
		+ ",left=" + posX + ",top=" + posY
		+ ",screenX=" + posX + ",screenY=" + posY
		+ ",toolbar=" + z + ",location=0,directories=0,status=" + z
		+ ",menubar=" + z + ",scrollbars=auto,resizable=1,width=" + x
		+ ",height=" + y;
	var remoteWin = null;
	remoteWin = window.open(url,name,winPref);
	if (window.focus)
	{
		remoteWin.focus();
	}
}


function abc(date)

{

document.datesform.datetext.value=date;

document.datesform.monthtext.value='may';

document.datesform.yeartext.value='2001';

document.datesform.categorytext.value='all';

datesform.submit();

}



function remoteus(){

winus=window.open("us.html","","width=620,height=455,scrollbars")

winus.creator=self

}


/*function setCookie()
{

	    var the_name1 = "Remember:"+document.LicenseKeyForm.remember.checked+"/Name:"+ document.LicenseKeyForm.userName.value +"/Country:"+document.LicenseKeyForm.country[document.LicenseKeyForm.country.selectedIndex].value +"/Company:"+document.LicenseKeyForm.companyName.value;
	    var the_name2="Email:"+ document.LicenseKeyForm.emailID.value +"/Phone:"+document.LicenseKeyForm.tel.value +"/Contact:"+document.LicenseKeyForm.contactMe.checked;						
	    var the_name= the_name1 + "/" + the_name2;	
	    var the_date = new Date("December 31, 2005");
	    var the_cookie_date = the_date.toGMTString();

	    // build and save the cookie
	    var the_cookie = "my_cookie=" + escape(the_name);
	    the_cookie = the_cookie + ";expires="+the_cookie_date+";path=/;domain=manageengine.adventnet.com;";
	    document.cookie = the_cookie;
	    //alert(document.cookie + "cookie set" + the_cookie);
}

function getCookie(the_info)
{
	if(document.cookie != '')
	{
		var the_cookie = document.cookie;
		var the_cookie = unescape(the_cookie);
		var broken_cookie = the_cookie.split("=");
		var the_values = broken_cookie[1];
		//alert(broken_cookie[1]);
		var separated_values = the_values.split("/");
		for (loop = 0; loop < separated_values.length; loop++)
		{
			property_value = separated_values[loop];
			var broken_info = property_value.split(":");
			var the_property = broken_info[0];
			var the_value = broken_info[1];
			the_info[the_property] = the_value;
		}
		//alert(the_info["Remember"]);
		if(the_info["Remember"]=="true")	
		{
			document.LicenseKeyForm.userName.value=the_info["Name"];	
			document.LicenseKeyForm.companyName.value=the_info["Company"];
			document.LicenseKeyForm.emailID.value=the_info["Email"];
			for (i=0 ; i< document.LicenseKeyForm.country.length; i++)
			{
				if(document.LicenseKeyForm.country[i].value==the_info["Country"])
				{
					document.LicenseKeyForm.country[i].selected=true;
					break;	
				}
			}
			document.LicenseKeyForm.tel.value=the_info["Phone"];	
			document.LicenseKeyForm.contactMe.checked=(the_info["Contact"]=="true");
		}
	}
}


function setCookie_new()
{
	    var the_name1 = "Name:"+ document.LicenseKeyForm.userName.value +"/Country:"+document.LicenseKeyForm.country[document.LicenseKeyForm.country.selectedIndex].value +"/Company:"+document.LicenseKeyForm.companyName.value;
	    var the_name2="Email:"+ document.LicenseKeyForm.emailID.value +"/Phone:"+document.LicenseKeyForm.tel.value;						
	    var the_name= the_name1 + "/" + the_name2;	
	    var the_date = new Date("December 31, 2010");
	    var the_cookie_date = the_date.toGMTString();

	    // build and save the cookie
	    
	    var the_cookie = "my_cookie=" + escape(the_name);
	    the_cookie = the_cookie + ";expires="+the_cookie_date+";path=/;domain=manageengine.adventnet.com;";
	    document.cookie = the_cookie;
	    //alert(document.cookie + "cookie set" + the_cookie);
}

function getCookie_new(the_info)
{
	//alert (document.cookie)
	if(document.cookie != '')
	{
		var the_cookie = document.cookie;
		var the_cookie = unescape(the_cookie);
		var broken_cookie = the_cookie.split("=");
		var the_values = broken_cookie[1];
		//alert(broken_cookie[1]);
		var separated_values = the_values.split("/");
		for (loop = 0; loop < separated_values.length; loop++)
		{
			property_value = separated_values[loop];
			var broken_info = property_value.split(":");
			var the_property = broken_info[0];
			var the_value = broken_info[1];
			the_info[the_property] = the_value;
		}

		document.LicenseKeyForm.userName.value=the_info["Name"];	
		document.LicenseKeyForm.companyName.value=the_info["Company"];
		document.LicenseKeyForm.emailID.value=the_info["Email"];
		for (i=0 ; i< document.LicenseKeyForm.country.length; i++)
		{
			if(document.LicenseKeyForm.country[i].value==the_info["Country"])
			{
				document.LicenseKeyForm.country[i].selected=true;
				break;	
			}
		}
		document.LicenseKeyForm.tel.value=the_info["Phone"];	
	}
}

function setCookie_me()
{

	    var the_name1 = "Remember:"+document.LicenseKeyForm.remember.checked+"/Name:"+ document.LicenseKeyForm.userName.value +"/Company:"+document.LicenseKeyForm.companyName.value;
	    var the_name2="Email:"+ document.LicenseKeyForm.emailID.value +"/Phone:"+document.LicenseKeyForm.tel.value;
	    var the_name= the_name1 + "/" + the_name2;	
	    var the_date = new Date("December 31, 2005");
	    var the_cookie_date = the_date.toGMTString();

	    // build and save the cookie
	    var the_cookie = "my_cookie=" + escape(the_name);
	    the_cookie = the_cookie + ";expires="+the_cookie_date+";path=/;domain=manageengine.adventnet.com;";
	    document.cookie = the_cookie;
	    //alert(document.cookie + "cookie set" + the_cookie);
}

function getCookie_me(the_info)
{
	if(document.cookie != '')
	{
		var the_cookie = document.cookie;
		var the_cookie = unescape(the_cookie);
		var broken_cookie = the_cookie.split("=");
		var the_values = broken_cookie[1];
		//alert(broken_cookie[1]);
		var separated_values = the_values.split("/");
		for (loop = 0; loop < separated_values.length; loop++)
		{
			property_value = separated_values[loop];
			var broken_info = property_value.split(":");
			var the_property = broken_info[0];
			var the_value = broken_info[1];
			the_info[the_property] = the_value;
		}
		if(the_info["Remember"]=="true")
		{
			document.LicenseKeyForm.userName.value=the_info["Name"];
			document.LicenseKeyForm.companyName.value=the_info["Company"];
			document.LicenseKeyForm.emailID.value=the_info["Email"];
			for (i=0 ; i< document.LicenseKeyForm.country.length; i++)
			{
				if(document.LicenseKeyForm.country[i].value==the_info["Country"])
				{
					document.LicenseKeyForm.country[i].selected=true;
					break;
				}
			}
			document.LicenseKeyForm.tel.value=the_info["Phone"];
		}
	}
}
*/
var specchar1 = new Array(" ","`","~","!","#","$","%","^","&","*","(",")","+","=","|","\"","{","}","[","]",":",";","\\","'","<",">","?","/",",");

var leading = /^\s*/g;

var trailing =/\s*$/g;

function emailCheck(email)

{

    var str = email;

    leadingremoved = str.replace(leading,"");

    str = leadingremoved.replace(trailing,"");

    var possp = 0;

    for(var i=0;i<specchar1.length;i++)

    {

	possp = str.indexOf(specchar1[i]);



	if (possp!=-1)

	{

	    alert("Invalid character in email address");

	    return false;

	}	

    }

    if(str=="")

    {

	alert("Please enter email address");

	return false;

    }



    if (str.length > 0)

    {

	var posadr1 = 0;

	var posdot = str.indexOf(".");

	var posadr = str.indexOf("@");

	posadr1=str.lastIndexOf("@");



	if ( (posdot < 0) || (posadr < 0) || (posadr1 != posadr) )

	{

	    alert("Invalid email address");

	    return false;

	}

    }

    var j = str.length;

    var strobj = new String(str);



    if (strobj.charAt(j-1)=="." || strobj.charAt(0)=="@" || strobj.charAt(j-1)=="@" || strobj.charAt(0)=="." || strobj.charAt(0)=="-" || strobj.charAt(0)=="_" || strobj.charAt(j-1)=="-" || strobj.charAt(j-1)=="_" || strobj.charAt(j-2)=="." || strobj.charAt(j-2)=="-" || strobj.charAt(j-2)=="_")

    {

	alert("Invalid email address");

	return false;

    }

    var spec = new Array(".","@","_","-");

    for(var i=0;i<j-2;i++)

    {

	for(var k=0;k<spec.length;k++)

	{

	    if(strobj.charAt(i)==spec[k])

	    {

		for(var l=0;l<spec.length;l++)

		{

		    if(strobj.charAt(i+1)==spec[l])

		    {

			alert("Invalid email address");

			return false;

		    }

		}

	    }

	}

    }

    return true;

}

var specchar = new Array("`","~","!","@","#","$","%","^","&","*","(",")","-","_","+","=","|","\"","{","}","[","]",":",";","\\","'","<",">","?","/",",");

function nameCheck(name,where)

{

    var str=name;

    var fromWhere = where;

    if(str=="")

    {

	alert("Please enter "+fromWhere);

	return false;

    }

    if(!isNaN(str.charAt(0)))

    {

	alert("The first character should be an alphabet");

	return false;

    }

    var possp = 0;

    for(var i=0;i<specchar.length;i++)

    {

	possp = str.indexOf(specchar[i]);

	if (possp!=-1)

	{

	    alert("Invalid character in "+fromWhere);

	    return false;

	}

    }



    return true;

}



var specchar2 = new Array("`","~","!","@","#","$","%","^","*","(",")","_","+","=","|","\"","{","}","[","]",":",";","\\","<",">","?","/");

function companyCheck(name,where)

{

    var str=name;

    var fromWhere = where;

    if(str=="")

    {

	alert("Please enter "+fromWhere);

	return false;

    }

    if(!isNaN(str.charAt(0)))

    {

	alert("The first character should be an alphabet");

	return false;

    }

    var possp = 0;

    for(var i=0;i<specchar2.length;i++)

    {

	possp = str.indexOf(specchar2[i]);

	if (possp!=-1)

	{

	    alert("Invalid character in "+fromWhere);

	    return false;

	}

    }



    return true;

}

function agree(str)

{

	var isagree=str;

	if (isagree == false)

        {

                alert("Please read the Licence Agreement and agree with the terms");  

                document.LicenseKeyForm.OtherProp_Agreement.focus();

                return false;

        }    

	return true;

}

function idCheck(id,where)

{

    var str=id;

    var fromWhere = where;

    if(str=="")

    {

	alert("Please enter "+fromWhere);

	return false;

    }

	else if(str.length !=10 )

	{

		alert("Please enter proper "+fromWhere);

		return false;

	}

	else

	{

		//TODO check the ID is valid by hashing

		return validateID(str,fromWhere);

	}

}

function isEmptyBox(text_value)

{

        text_value= text_value.replace (/^(\s+)/, "").replace (/(\s+)$/, "")   

        if(text_value == "") 

         return true; 

        return false;  

}

function MM_openBrWindow(theURL,winName,features)

{

  window.open(theURL,winName,features);

}



// * Buy Now form validation

var name=new Array()



function setName(){

for (i=0;i<setName.arguments.length;i++)

	{

	name[i]=setName.arguments[i]

	}

}



function validateFrm()

{

error=0

var err="The following field(s) should not be empty:\n"

arg=validateFrm.arguments

arglen=validateFrm.arguments.length



for(i=0;i<arglen;i++){

	if(arg[i].value==""){

	 err=err+"     » "+name[i]+"\n";

	 error=1

	 }

}



if (error!=0){

alert(err)

return false

}

return true

}





//checking special character other than "_" and "-"

function isLetter (c)

{

return ((c=="")|| ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z"))||(c=="-")||(c=="_")||(c>=0))

}	

    

function validateSpl(obj,val)

{

if (val!=""){

	for (i = 0; i < val.length; i++)

		{   

			var c = val.charAt(i);

			if (!isLetter(c)){

			alert("View Name should not be null or contains special character"); 	    

			obj.focus();

			return false;

			}

		}

    }

else {

    alert("View Name should not be null")

    return false;

    }

}







function chkValid(obj,email){

	var objRegExp  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;

	if(!objRegExp.test(email)){

	alert("Enter Valid Email ID")

	obj.focus()

	return false;

	

	}

return true;

	}



function CheckSplChar(compname)

{

	var val = compname;

	firstChar = val.charAt(0)

	if(!isLetter(firstChar)){

	alert("Company Name's first letter should be only Alphabet!")

	return false;

	}

return true;

}

function validate(){

if((validateFrm(document.form.userName,document.form.companyName,document.form.emailID,document.form.product,document.form.tel))&&(chkValid(document.form.emailID,document.form.emailID.value))){

return true;

}

else return false;

}

//-->


