//#################################################//
// Special Char regular expression string
//#################################################//
//A non-word character
var reg_nonword = /[\W]/;
var reg_space = /[\s]/;
var reg_start_space = /[^\s]/;
// a alpha numeric character
var reg_alphanumeric = /[a-zA-Z_0-9]/;
// a alpha numeric character
var reg_alpha = "#$%^&*()+=-[]\\/{}|~<>";
// a numeric character
var reg_digit = /[\d]/;
// non digit
var re = /[\D]/;


// validate email
function checkMail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email))
	 	return true;
	else 
		return false;
}


function check_float(str,msgstr)
{
	var iChars = "~`!@#$%^&*()=[]\\/{}|~<>;:'\"-_+',ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  	for (var i = 0; i < str.length; i++) 
  	{
	  	if (iChars.indexOf(str.charAt(i)) != -1) 
	  	{
		  	alert ("Only Dot \".\" is allowed in "+msgstr+".");
			return "false";
	  	}
  	}
}


// validate URL
function checkURL(strURL)
{
	var filter  = /^(w{3})+\.(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(strURL))
	 	return true;
	else 
		return false;
}

// special char checking function for numeric only
function check_num(str)
{
	var iChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  	for (var i = 0; i < str.length; i++) 
  	{
	  	//alert(iChars.indexOf(str.charAt(i)));
	  	if (iChars.indexOf(str.charAt(i)) != -1) 
	  	{
		  	//alert ("Only numeric are not allowed.");
			return "true";
	  	}
  	}
}



// for limiting text input
function textLimit(field, maxlen) 
{
	if (field.value.length > maxlen + 1)
		alert('your input has been truncated!');
	if (field.value.length > maxlen)
		field.value = field.value.substring(0, maxlen);
}

	




function ValidateCheckoutForm(fn)
{
	var d = eval("document."+fn);
	if(d.Mailboxes.value=="")
	{
		alert("Please enter First Name:");
		d.Mailboxes.focus();
		return false;
	}
	if(d.lastname.value=="")
	{
		alert("Please enter Agent Last Name:");
		d.lastname.focus();
		return false;
	}
	if(d.lastname.value=="")
	{
		alert("Please enter Agent Last Name:");
		d.lastname.focus();
		return false;
	}
	if(d.email.value=="")
	{
		alert("Please enter your Email address");
		d.email.select();
		return false;
	}
	else
	{
		if(!checkMail(d.email.value))
		{
			alert("Please enter a valid Email address");
			d.email.select();
			return false;
		}	
	}
	
	if(d.status.value=="")
	{
		alert("Please Select the status");
		d.status.focus();
		return false;
	}	
		
	return true;
}


function validatecontactform()
{
	if(document.contactform.name.value=="")
	{
		alert("Please enter Your  First Name:");
		document.contactform.name.focus();
		return false;
	}
	if(document.contactform.lname.value=="")
	{
		alert("Please enter Your Last Name:");
		document.contactform.lname.focus();
		return false;
	}
	if(document.contactform.organisation.value=="")
	{
		alert("Please enter Your Organisation Name:");
		document.contactform.organisation.focus();
		return false;
	}
	if(document.contactform.phone.value=="")
	{
		alert("Please enter your Phone Number:");
		document.contactform.phone.focus();
		return false;
	}
	if(document.contactform.email.value=="")
	{
		alert("Please enter your Email address");
		document.contactform.email.select();
		return false;
	}
	else
	{
		if(!checkMail(document.contactform.email.value))
		{
			alert("Please enter a valid Email address");
			document.contactform.email.select();
			return false;
		}	
	}
	return true;
}

//############################################################
menu_status = new Array();

function showHide(theid){

/*
+-----------------------------------------------------------------------------------------------------+
	Code Added by Biraj on 13th May 2008
	Purpose: Show/hide of Left menu pannel
	
+------------------------------------------------------------------------------------------------------+
*/

  if (document.getElementById) {
    var switch_id = document.getElementById(theid);
	if(theid=="mymenu1"){
			if(menu_status["mymenu1"] != 'show') {
			   switch_id.className = 'show';
			   menu_status["mymenu1"] = 'show';
			   document.getElementById("mymenu2").className = 'hide';
			   menu_status["mymenu2"] = 'hide';
			  document.getElementById("mymenu3").className = 'hide';
			   menu_status["mymenu3"] = 'hide';
			   document.getElementById("mymenu4").className = 'hide';
			   menu_status["mymenu4"] = 'hide';
			}else{
			   switch_id.className = 'hide';
			   menu_status["mymenu1"] = 'hide';
			}
		}else if(theid=="mymenu2"){
			if(menu_status["mymenu2"] != 'show') {
			   switch_id.className = 'show';
			   menu_status["mymenu2"] = 'show';
			   document.getElementById("mymenu1").className = 'hide';
			   menu_status["mymenu1"] = 'hide';
			   document.getElementById("mymenu3").className = 'hide';
			   menu_status["mymenu3"] = 'hide';
			   document.getElementById("mymenu4").className = 'hide';
			   menu_status["mymenu4"] = 'hide';
			}else{
			   switch_id.className = 'hide';
			   menu_status["mymenu2"] = 'hide';
			}
		}else if(theid=="mymenu3"){
			if(menu_status["mymenu3"] != 'show') {
			   switch_id.className = 'show';
			   menu_status["mymenu3"] = 'show';
			   document.getElementById("mymenu1").className = 'hide';
			   menu_status["mymenu1"] = 'hide';
			   document.getElementById("mymenu2").className = 'hide';
			   menu_status["mymenu2"] = 'hide';
			   document.getElementById("mymenu4").className = 'hide';
			   menu_status["mymenu4"] = 'hide';
			}else{
			   switch_id.className = 'hide';
			   menu_status["mymenu3"] = 'hide';
			}

		}else if(theid=="mymenu4"){
			if(menu_status["mymenu4"] != 'show') {
			   switch_id.className = 'show';
			   menu_status["mymenu4"] = 'show';
			   document.getElementById("mymenu1").className = 'hide';
			   menu_status["mymenu1"] = 'hide';
			   document.getElementById("mymenu2").className = 'hide';
			   menu_status["mymenu2"] = 'hide';
			   document.getElementById("mymenu3").className = 'hide';
			   menu_status["mymenu3"] = 'hide';
			}else{
			   switch_id.className = 'hide';
			   menu_status["mymenu4"] = 'hide';
			}
		}

    }

/*---------------------Code End ---------------------------*/

	/*
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);
	alert(menu_status[theid]);
        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
		   alert(theid);
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
		   alert(theid);
        }
    }
	*/

	

}


/*
//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="webhostplan.html">Website Hosting</a>'
menu1[1]='<a href="webhostingplan.html">Web Hosting Plan</a>'
menu1[2]='<a href="webmaintenanceplan1.html">Website Maintainance 1</a>'
menu1[3]='<a href="webmaintenanceplan2.html">Website Maintainance 2</a>'
menu1[4]='<a href="webdesigncreation.html">Website Design</a>'
menu1[5]='<a href="colocationwebhosting.html">Colocation</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="saas.html">What is Saas (Software as &nbsp;&nbsp;&nbsp;a Service)?</a>'
menu2[1]='<a href="outsrcapphost.html">Why outsource it to us?</a>'
menu2[2]='<a href="requestapp.html">Request a Proposal</a>'

//Contents for menu 3, and so on
var menu3=new Array()
menu3[0]='<a href="spplana.html">Share Point Plan 1</a>'
menu3[1]='<a href="spplanb.html">Share Point Plan 2</a>'
menu3[2]='<a href="whysharepoint.html">Why SharePoint</a>'
menu3[3]='<a href="whyapps4rent.html">Why Apps4Rent</a>'

//Contents for menu 4, and so on
var menu4=new Array()
menu4[0]='<a href="heplana.html">Small Enterprise</a>'
menu4[1]='<a href="heplanb.html">Medium Enterprise</a>'
menu4[2]='<a href="why.html">Why Microsoft Exchange?</a>'
menu4[3]='<a href="benefitexc.html">Benefits of Hosted  &nbsp;&nbsp;&nbsp;Exchange</a>'
menu4[5]='<a href="newexc.html">New in Exchange 2007</a>'
menu4[6]='<a href="mobilityexc.html">Mobility</a>'
menu4[7]='<a href="outsourceexc.html">Why Outsource to Us?</a>'
menu4[8]='<a href="migratingexc.html">Migrating to Exchange 2007</a>'
menu4[9]='<a href="reseller.html">Reseller</a>'
menu4[10]='<a href="calcuroi.html">Calculate ROI</a>'

//Contents for menu 5, and so on
var menu5=new Array()
menu5[0]='<b>Our servers </b>are hosted at one of the state-of-the-art datacenters which are used by large financial corporations.  This provides our customers truly enterprise grade experience at an affordable cost.'
menu5[1]='<b>With the </b>clustering technology and redundancy we can deliver your e-mails without any interruption.'
menu5[2]='<b>With Power </b>supply from multiple providers and a full fledged generator/UPS backup for power we can guarantee 99.99% and more availability of Power.'
menu5[3]='<b>The datacenter </b>has comprehensive video surveillance.'
menu5[4]='<b>Datacenter is </b>setup with redundant fire suppression system like smoke/heat sensors; dual action dry pipe sprinkler system; and smoke and fire detection system. These are backup by many fire extinguishers which are situated throughout the facilty.'
menu5[5]='<b>The servers </b>are kept at an optimized temperature using multiple Air Conditioners. These units are connected to the essential power services. This ensures that the Air Conditioners are on even in the event of power outage. Redundant system is in place for Air Conditioners. Rooms are monitored on a 24 X 7 basis so as to maintain the optimum temperature.'
menu5[6]='<b>Redundant Internet </b>backbone. We have the ability to connect through multiple datacenters for connectivity failover. This ensures that there is no downtime.'



var menuwidth='169px' //default menu width
var menubgcolor='#E9E9E9'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=15; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
} */

var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
 if (newWin != null && !newWin.closed)
   newWin.close();
 var strOptions="";
 if (strType=="console")
   strOptions="resizable,height="+
     strHeight+",width="+strWidth;
 if (strType=="fixed")
   strOptions="status,height="+
     strHeight+",width="+strWidth;
 if (strType=="elastic")
   strOptions="scrollbars,"+
     "resizable,height="+
     strHeight+",width="+strWidth;
 newWin = window.open(strURL, 'newWin', strOptions);
 newWin.focus();
}
