var timeout	= 300;
var closetimer	= 0;
var ddmenuitem	= 0;

/******** admin : confirmation msg for delete ************/
function confirmAction(msg)
{
	if(confirm(msg)) return true;
	return false;
}

/********* admin : checking for company ***********/
function chkCompany(companydetail)
{
	if(companydetail.cname.value == '')
	{
		alert('Enter Company name');
		companydetail.cname.focus();	
		return false;
	}
	if(companydetail.cemail.value == '')
	{
		alert('Enter Email Id');
		companydetail.cemail.focus();	
		return false;
	}
	else if(!(companydetail.cemail.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
	{
		alert('Enter valid email id');
		companydetail.cemail.focus();
		return false;
	}
	if(companydetail.caddress.value == '')
	{
		alert('Enter Company address');
		companydetail.caddress.focus();	
		return false;
	}
	if(companydetail.ccity.value == '')
	{
		alert('Enter city name');
		companydetail.ccity.focus();	
		return false;
	}
	if(companydetail.ccountry.value == '')
	{
		alert('Select country');
		companydetail.ccountry.focus();	
		return false;
	}
	return true;
}

/******** admin : cheking for shared plan form ************/
function chkSharedplan(sharedplan)
{
	if(sharedplan.scname.value == '')
	{
		alert('Select Company name');
		sharedplan.scname.focus();	
		return false;
	}
	if(sharedplan.sname.value == '')
	{
		alert('Enter Plan name');
		sharedplan.sname.focus();	
		return false;
	}
	if(sharedplan.hdd_space.value != '')
	{
		var hddspace = sharedplan.hdd_space.value;
		if(!(hddspace.match(/^[-+]?(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('It Should be Integer value');
			sharedplan.hdd_space.focus();
			return false;
		}
	}
	if(sharedplan.data_transfer.value != '')
	{
		var datatransfer = sharedplan.data_transfer.value;
		if(!(datatransfer.match(/^[-+]?(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('It Should be Integer value');
			sharedplan.data_transfer.focus();
			return false;
		}
	}

	if(sharedplan.monthly_price.value != '')
	{
		var mprice = sharedplan.monthly_price.value;
		if(!(mprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			sharedplan.monthly_price.focus();
			return false;
		}
	}
	if(sharedplan.quaterly_price.value != '')
	{
		var qprice = sharedplan.quaterly_price.value;
		if(!(qprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			sharedplan.quaterly_price.focus();
			return false;
		}
	}
	if(sharedplan.half_yearly_price.value != '')
	{
		var hprice = sharedplan.half_yearly_price.value;
		if(!(hprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			sharedplan.half_yearly_price.focus();
			return false;
		}
	}
	if(sharedplan.yearly_price.value != '')
	{
		var yprice = sharedplan.yearly_price.value;
		if(!(yprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			sharedplan.yearly_price.focus();
			return false;
		}
	}
	if(sharedplan.email_accounts.value != '')
	{
		var eacc = sharedplan.email_accounts.value;
		if(!(eacc.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			sharedplan.email_accounts.focus();
			return false;
		}
	}
	if(sharedplan.num_domains.value != '')
	{
		var ndomains = sharedplan.num_domains.value;
		if(!(ndomains.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			sharedplan.num_domains.focus();
			return false;
		}
	}
	if(sharedplan.money_back.value != '')
	{
		var mback = sharedplan.money_back.value;
		if(!(mback.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			sharedplan.money_back.focus();
			return false;
		}
	}

    if(sharedplan.plan_status.value == 'D' && sharedplan.disable_reason.value == '')
    {
        alert('Please fill reason for disable this plan');
        document.getElementById('plan_status').style.display='';
        sharedplan.disable_reason.focus();  
        return false;
    }	
	return true;
}

/********* admin : cheking for deidcated plan form ***********/
function chkDedicatedplan(dedicatedplan)
{
	if(dedicatedplan.dname.value == '')
	{
		alert('Enter Plan name');
		dedicatedplan.dname.focus();	
		return false;
	}
	if(dedicatedplan.ram.value != '')
	{
		var ramamount = dedicatedplan.ram.value;
		if(!(ramamount.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid RAM');
			dedicatedplan.ram.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_capacity.value != '')
	{
		var hddcapacity = dedicatedplan.hdd_capacity.value;
		if(!(hddcapacity.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_capacity.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_count.value != '')
	{
		var hddcount = dedicatedplan.hdd_count.value;
		if(!(hddcount.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_count.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_rpm.value != '')
	{
		var hddrpm = dedicatedplan.hdd_rpm.value;
		if(!(hddrpm.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_rpm.focus();
			return false;
		}
	}
	if(dedicatedplan.bandwidth.value != '')
	{
		var bandwidth = dedicatedplan.bandwidth.value;
		if(!(bandwidth.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.bandwidth.focus();
			return false;
		}
	}
	if(dedicatedplan.price.value != '')
	{
		var price = dedicatedplan.price.value;
		if(!(price.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			dedicatedplan.price.focus();
			return false;
		}
	}
    if(dedicatedplan.plan_status.value == 'D' && dedicatedplan.disable_reason.value == '')
    {
        alert('Please fill reason for disable this plan');
        document.getElementById('plan_status').style.display='';
        dedicatedplan.disable_reason.focus();  
        return false;
    }
	return true;
}

/******** admin : cheking for vps plan form ************/
function chkVPSplan(vpsplan)
{
	if(vpsplan.vname.value == '')
	{
		alert('Enter Plan name');
		vpsplan.vname.focus();	
		return false;
	}
	if(vpsplan.space.value != '')
	{
		var space = vpsplan.space.value;
		if(!(space.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.space.focus();
			return false;
		}
	}
	if(vpsplan.transfer.value != '')
	{
		var transfer = vpsplan.transfer.value;
		if(!(transfer.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.transfer.focus();
			return false;
		}
	}
	if(vpsplan.price.value != '')
	{
		var price = vpsplan.price.value;
		if(!(price.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			vpsplan.price.focus();
			return false;
		}
	}	
	if(vpsplan.number_of_domain.value != '')
	{
		var domains = vpsplan.number_of_domain.value;
		if(!(domains.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.number_of_domain.focus();
			return false;
		}
	}
	if(vpsplan.guranted_ram.value != '')
	{
		var gram = vpsplan.guranted_ram.value;
		if(!(gram.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid Guranted RAM');
			vpsplan.guranted_ram.focus();
			return false;
		}
	}
	if(vpsplan.burstable_ram.value != '')
	{
		var bram = vpsplan.burstable_ram.value;
		if(!(bram.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid Burstable RAM');
			vpsplan.burstable_ram.focus();
			return false;
		}
	}	
    if(vpsplan.plan_status.value == 'D' && vpsplan.disable_reason.value == '')
    {
        alert('Please fill reason for disable this plan');
        document.getElementById('plan_status').style.display='';
        vpsplan.disable_reason.focus();  
        return false;
    }
	return true;
}

/********* admin : for plan page it's display company url and it's plan onchange of company ***********/
function GetCompanyDetail(csel,filenm,plantype)
{
	var optiontext = csel.options[csel.selectedIndex].text;
	var optionvalue = csel.options[csel.selectedIndex].value;
	var durl = companyurl[optionvalue];
	if(plantype == 'S')
	{
		var plan = 'Shared';
	}
	if(plantype == 'D')
	{
		var plan = 'Dedicated';
	}
	if(plantype == 'V')
	{
		var plan = 'VPS';
	}
	if(optionvalue == '')
	{
		document.getElementById('ShowPlan').style.display = 'none';
	}
	else
	{
		document.getElementById('ShowPlan').style.display = '';
		document.getElementById('ShowPlan').innerHTML = "&nbsp;&nbsp;url :&nbsp;<a href=http:&#047;&#047;"+durl+" target=_blank>"+durl+"</a><br><div style=height:6px></div><a href="+filenm+"?plan="+plantype+"&#038;cid="+optionvalue+">Show Added "+plan+" plan of <b>"+optiontext+"</b></a>";
	}
}

/********* user : cheking for comapny's rating***********/
function checkratingform()
{
	if(document.ratingfrm.usercomment.value == '')
	{
		alert('Enter comment');
		document.ratingfrm.usercomment.focus();	
		return false;
	}
	if(document.ratingfrm.security_code.value == '')
	{
		alert('Enter image code shown below');
		document.ratingfrm.security_code.focus();	
		return false;
	}
	return true;
}

function chkRateReview()
{
    if(document.ratingfrm.txtUserName.value == '')
    {
        alert('You must specify your Name');
        document.ratingfrm.txtUserName.focus();
        return false;
    }

    if(document.ratingfrm.txtUserEmail.value == '')
    {
        alert('You must specify your Email Id');
        document.ratingfrm.txtUserEmail.focus();
        return false;
    }

    if(!(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(document.ratingfrm.txtUserEmail.value)))
    {
        alert('You must specify a valid Email Id');
        document.ratingfrm.txtUserEmail.focus();
        return false;
    }

    if(document.ratingfrm.txtDomain.value == '')
    {
        alert('You must specify a domain name');
        document.ratingfrm.txtDomain.focus();
        return false;
    }

// 	var thisis = document.ratingfrm.txtUserEmail.value.indexOf('@');
// 	var emaildomain = document.ratingfrm.txtUserEmail.value.substring(thisis+1);
// 	alert(emaildomain);
// 
// 	var domainpart = document.ratingfrm.txtDomain.value.match(/^www$/);
// 	alert(domainpart);
// 	return false;

    if(document.ratingfrm.txtComments.value == '')
    {
        alert('You must provide comments for the host');
        document.ratingfrm.txtComments.focus();
        return false;
    }

    if(document.ratingfrm.security_code.value == '')
    {
        alert('You must verify the image text');
        document.ratingfrm.security_code.focus();
        return false;
    }

    return true;
}

function chkAdminRateReview()
{
    if(document.ratingfrm.txtComments.value == '')
    {
        alert('You must provide comments for the host');
        document.ratingfrm.txtComments.focus();
        return false;
    }

    return true;
}


/******** user : for company's review show************/
function showReview(hiddenreview)
{
	document.getElementById('reviewtype').innerHTML = "<a href='javascript:void(0);' onclick='hideReview("+hiddenreview+");' class='alllink'><u>Less [-]</u></a>";
	document.getElementById('ShowReview').style.display = '';
}

/******** user : for company's review hide ************/
function hideReview(hiddenreview)
{
	document.getElementById('reviewtype').innerHTML = "<a onclick='showReview("+hiddenreview+");' href='javascript:void(0);' class='alllink'><u>More [+]</u></a>&nbsp;("+hiddenreview+" hidden)";
	document.getElementById('ShowReview').style.display = 'none';
}

/********* user : for article's rating show **************/
function DisplayRating()
{
	document.getElementById('articlerating').style.display = '';
}
/********* user : for article's rating hide **************/
function hideRating()
{
	document.getElementById('articlerating').style.display = 'none';

}

/********* user : cheking for article's comment form ************/
function checkingartcomment()
{
	if(document.articelcomm.articleemail.value != '')
	{
		if(!(document.articelcomm.articleemail.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
		{
			alert('Enter valid email id');
			document.articelcomm.articleemail.focus();
			return false;
		}	
	}
	if(document.articelcomm.articlecomment.value == '')
	{
		alert('Enter Comment');
		document.articelcomm.articlecomment.focus();
		return false;
	}
	if(document.articelcomm.security_code.value == '')
	{
		alert('Enter image code shown below');
		document.articelcomm.security_code.focus();
		return false;
	}
	return true;
}

/*********** user : cheking for article's rating form ***************/
function checkingartrating()
{
	if(document.ratingart.ratefeed.value == '')
	{
		alert('Enter Feedback');
		document.ratingart.ratefeed.focus();
		return false;
	}
	if(document.ratingart.ratesecurity_code.value == '')
	{
		alert('Enter image code shown below');
		document.ratingart.ratesecurity_code.focus();
		return false;
	}
	return true;
}

/*********** user : cheking for give feed back form *****************/
function checkinggiveFeedback()
{
	if(document.FeedBack.feedname.value == '')
	{
		alert('Enter your name');
		document.FeedBack.feedname.focus();
		return false;
	}
	if(document.FeedBack.feedemail.value == '')
	{
		alert('Enter your email id');
		document.FeedBack.feedemail.focus();
		return false;
	}
	else if(!(document.FeedBack.feedemail.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
	{
		alert('Enter valid email id');
		document.FeedBack.feedemail.focus();
		return false;
	}
	if(document.FeedBack.give_feedback.value == '')
	{
		alert('Enter Feedback');
		document.FeedBack.give_feedback.focus();
		return false;
	}
	if(document.FeedBack.security_code.value == '')
	{
		alert('Enter image code shown below');
		document.FeedBack.security_code.focus();
		return false;
	}
	return true;
}

/********* user : cheking for advertise form **************/
function chkingadvr()
{
	if(document.advr.advrname.value == '')
	{
		alert('Enter your name');
		document.advr.advrname.focus();
		return false;
	}
	if(document.advr.advrsite.value == '' || document.advr.advrsite.value == 'http://' )
	{
		alert('Enter Sitename');
		document.advr.advrsite.focus();
		return false;
	}	
	if(document.advr.advremail.value == '')
	{
		alert('Enter your email id');
		document.advr.advremail.focus();
		return false;
	}
	else if(!(document.advr.advremail.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
	{
		alert('Enter valid email id');
		document.advr.advremail.focus();
		return false;
	}
	return true;
}

/************ user : for company list country vise **************/
function CountryList(countryurl)
{
	var countyrnm = document.countyhosting.countryls.value;
	window.location=countryurl+countyrnm;
	
}
/**********user : for more tab's submenu show *************/
function displaymenu()
{
	document.getElementById('more_menu').style.display = '';
}
/**********user : for more tab's submenu hide *************/
function nodisplaymenu()
{
	document.getElementById('more_menu').style.display = 'none';
}

/********** user : cheking for registration form **************/
function chkingUserRegistration(profiletype)
{
	if(document.userlogin.fname.value == '')
	{
		alert('Enter your first name');
		document.userlogin.fname.focus();
		return false;
	}
	if(profiletype == 'Y')
	{
		if(document.userlogin.useremail.value == '')
		{
			alert('Enter your email id');
			document.userlogin.useremail.focus();
			return false;
		}
		else if(!(document.userlogin.useremail.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
		{
			alert('Enter valid email id');
			document.userlogin.useremail.focus();
			return false;
		}
	
		if(document.userlogin.userpass.value == '')
		{
			alert('Enter password');
			document.userlogin.userpass.focus();
			return false;
		}
	}

	if(document.userlogin.comname.value == '')
	{
		alert('Enter company name');
		document.userlogin.comname.focus();
		return false;
	}
	if(document.userlogin.comurl.value == '')
	{
		alert('Enter company url');
		document.userlogin.comurl.focus();
		return false;
	}
	if(document.userlogin.security_code.value == '')
	{
		alert('Enter image code shown below');
		document.userlogin.security_code.focus();
		return false;
	}
	return true;
}

/********** user : cheking for forgot password form ************/
function chkingPassEmail()
{
	if(document.LostPass.email.value == '')
	{
		alert('Enter your email id');
		document.LostPass.email.focus();
		return false;
	}
	else if(!(document.LostPass.email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
	{
		alert('Enter valid email id');
		document.LostPass.email.focus();
		return false;
	}
	return true;
}

/******** user : cheking for login form **************/
function chkingLogin()
{
	if(document.loginform.username.value == '')
	{
		alert('Enter username');
		document.loginform.username.focus();
		return false;
	}
	if(document.loginform.passwd.value == '')
	{
		alert('Enter password');
		document.loginform.passwd.focus();
		return false;
	}
	return true;
}
/******** user : cheking for chage password form **************/
function chkingchgpass()
{
	if(document.usercpass.username.value == '')
	{
		alert('Enter username');
		document.usercpass.username.focus();
		return false;
	}
	if(document.usercpass.oldpass.value == '')
	{
		alert('Enter old password');
		document.usercpass.oldpass.focus();
		return false;
	}
	if(document.usercpass.newpass.value == '')
	{
		alert('Enter new password');
		document.usercpass.newpass.focus();
		return false;
	}
	if(document.usercpass.connewpass.value == '')
	{
		alert('Enter confirm password');
		document.usercpass.connewpass.focus();
		return false;
	}
	if(document.usercpass.newpass.value != document.usercpass.connewpass.value)
	{
		alert('Your confirm password does not match');
		document.usercpass.connewpass.focus();
		return false;
	}
	return true;
}

/********** user : cheking for shared plan form **************/
function UserSharedplanchking(usersharedplan)
{
	if(usersharedplan.sname.value == '')
	{
		alert('Enter Plan name');
		usersharedplan.sname.focus();	
		return false;
	}

	if(usersharedplan.hdd_space.value == '')
	{
		alert('Enter Harddisk space');
		usersharedplan.hdd_space.focus();
		return false;
	}

	else if(usersharedplan.hdd_space.value != '')
	{
		var hddspace = usersharedplan.hdd_space.value;
		if(!(hddspace.match(/^[-+]?(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('It Should be Integer value');
			usersharedplan.hdd_space.focus();
			return false;
		}
	}
	if(usersharedplan.data_transfer.value == '')
	{
		alert('Enter Data transfer');
		usersharedplan.data_transfer.focus();
		return false;
	}

	else if(usersharedplan.data_transfer.value != '')
	{
		var datatransfer = usersharedplan.data_transfer.value;
		if(!(datatransfer.match(/^[-+]?(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('It Should be Integer value');
			usersharedplan.data_transfer.focus();
			return false;
		}
	}

	if(usersharedplan.monthly_price.value == '')
	{
		alert('Enter monthly price');
		usersharedplan.monthly_price.focus();
		return false;
	}

	else if(usersharedplan.monthly_price.value != '')
	{
		var mprice = usersharedplan.monthly_price.value;
		if(!(mprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			usersharedplan.monthly_price.focus();
			return false;
		}
	}
	if(usersharedplan.quaterly_price.value != '')
	{
		var qprice = usersharedplan.quaterly_price.value;
		if(!(qprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			usersharedplan.quaterly_price.focus();
			return false;
		}
	}
	if(usersharedplan.half_yearly_price.value != '')
	{
		var hprice = usersharedplan.half_yearly_price.value;
		if(!(hprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			usersharedplan.half_yearly_price.focus();
			return false;
		}
	}
	if(usersharedplan.yearly_price.value == '')
	{
		alert('Enter yearly price');
		usersharedplan.yearly_price.focus();
		return false;
	}

	else if(usersharedplan.yearly_price.value != '')
	{
		var yprice = usersharedplan.yearly_price.value;
		if(!(yprice.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			usersharedplan.yearly_price.focus();
			return false;
		}
	}
	if(usersharedplan.email_accounts.value == '')
	{
		alert('Enter no. of email accounts');
		usersharedplan.email_accounts.focus();
		return false;
	}

	else if(usersharedplan.email_accounts.value != '')
	{
		var eacc = usersharedplan.email_accounts.value;
		if(!(eacc.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			usersharedplan.email_accounts.focus();
			return false;
		}
	}
	if(usersharedplan.num_domains.value == '')
	{
		alert('Enter number of domains');
		usersharedplan.num_domains.focus();
		return false;
	}
	
	else if(usersharedplan.num_domains.value != '')
	{
		var ndomains = usersharedplan.num_domains.value;
		if(!(ndomains.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			usersharedplan.num_domains.focus();
			return false;
		}
	}
	if(usersharedplan.money_back.value != '')
	{
		var mback = usersharedplan.money_back.value;
		if(!(mback.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			usersharedplan.money_back.focus();
			return false;
		}
	}
	if(usersharedplan.plan_url.value == '')
	{
		alert('Enter plan url');
		usersharedplan.plan_url.focus();
		return false;
	}
	
	return true;
}
/*********** user : cheking for user's dedicated plan form ***************/
function UserDedicatedplanchking(dedicatedplan)
{
	if(dedicatedplan.dname.value == '')
	{
		alert('Enter Plan name');
		dedicatedplan.dname.focus();	
		return false;
	}
	if(dedicatedplan.ram.value != '')
	{
		var ramamount = dedicatedplan.ram.value;
		if(!(ramamount.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid RAM');
			dedicatedplan.ram.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_capacity.value == '')
	{
		alert('Enter harddisk capacity');
		dedicatedplan.hdd_capacity.focus();
		return false;
	}
	else if(dedicatedplan.hdd_capacity.value != '')
	{
		var hddcapacity = dedicatedplan.hdd_capacity.value;
		if(!(hddcapacity.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_capacity.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_count.value == '')
	{
		alert('Enter harddisk count');
		dedicatedplan.hdd_count.focus();
		return false;

	}
	else if(dedicatedplan.hdd_count.value != '')
	{
		var hddcount = dedicatedplan.hdd_count.value;
		if(!(hddcount.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_count.focus();
			return false;
		}
	}
	if(dedicatedplan.hdd_rpm.value == '')
	{
		alert('Enter Harddisk rpm');
		dedicatedplan.hdd_rpm.focus();
		return false;
	}
	else if(dedicatedplan.hdd_rpm.value != '')
	{
		var hddrpm = dedicatedplan.hdd_rpm.value;
		if(!(hddrpm.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.hdd_rpm.focus();
			return false;
		}
	}
	if(dedicatedplan.bandwidth.value != '')
	{
		var bandwidth = dedicatedplan.bandwidth.value;
		if(!(bandwidth.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			dedicatedplan.bandwidth.focus();
			return false;
		}
	}
	if(dedicatedplan.price.value == '')
	{
		alert('Enter price');
		dedicatedplan.price.focus();
		return false;
	}
	else if(dedicatedplan.price.value != '')
	{
		var price = dedicatedplan.price.value;
		if(!(price.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			dedicatedplan.price.focus();
			return false;
		}
	}
	if(dedicatedplan.plan_url.value == '')
	{
		alert('Enter Plan url');
		dedicatedplan.plan_url.focus();
		return false;
	}
	return true;
}

/******** user : cheking for user's vps plan form **************/
function UserVPSplanchking(vpsplan)
{
	if(vpsplan.vname.value == '')
	{
		alert('Enter Plan name');
		vpsplan.vname.focus();	
		return false;
	}
	if(vpsplan.space.value == '')
	{
		alert('Enter Harddisk space');
		vpsplan.space.focus();
		return false;
	}
	else if(vpsplan.space.value != '')
	{
		var space = vpsplan.space.value;
		if(!(space.match(/^(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.space.focus();
			return false;
		}
	}
	if(vpsplan.transfer.value == '')
	{
		alert('Enter Data transfer');
		vpsplan.transfer.focus();
		return false;
	}
	else if(vpsplan.transfer.value != '')
	{
		var transfer = vpsplan.transfer.value;
		if(!(transfer.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.transfer.focus();
			return false;
		}
	}
	if(vpsplan.price.value == '')
	{
		alert('Enter price');
		vpsplan.price.focus();
		return false;
	}	
	else if(vpsplan.price.value != '')
	{
		var price = vpsplan.price.value;
		if(!(price.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('wrong price');
			vpsplan.price.focus();
			return false;
		}
	}	
	if(vpsplan.number_of_domain.value == '')
	{
		alert('Enter no. of domain');
		vpsplan.number_of_domain.focus();
		return false;
	}
	else if(vpsplan.number_of_domain.value != '')
	{
		var domains = vpsplan.number_of_domain.value;
		if(!(domains.match(/^[-+]?(\d+|){1,10}$/)))
		{
			alert('It Should be Integer value');
			vpsplan.number_of_domain.focus();
			return false;
		}
	}
	if(vpsplan.guranted_ram.value != '')
	{
		var gram = vpsplan.guranted_ram.value;
		if(!(gram.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid Guranted RAM');
			vpsplan.guranted_ram.focus();
			return false;
		}
	}
	if(vpsplan.burstable_ram.value != '')
	{
		var bram = vpsplan.burstable_ram.value;
		if(!(bram.match(/^(\d+|)(\.|)(\d+){1,10}$/)))
		{
			alert('Invalid Burstable RAM');
			vpsplan.burstable_ram.focus();
			return false;
		}
	}
	if(vpsplan.plan_url.value == '')
	{
		alert('Enter Plan url');
		vpsplan.plan_url.focus();
		return false;
	}	
	return true;
}

/******** user : cheking for pagerank form *************/
function ChekingPageRank()
{
	if(document.PageRank.domainname.value == '' || document.PageRank.domainname.value == 'www.')
	{
		alert('Enter Domain name');
		document.PageRank.domainname.focus();
		return false;
	}
	if(document.PageRank.security_code.value == '')
	{
		alert('Enter Word verification');
		document.PageRank.security_code.focus();
		return false;
	}
	return true;
}

function loadEmails(s)
{
	if(s == 'one')
	{
		document.getElementById('one').style.display = '';
		document.getElementById('two').style.display = 'none';
		document.getElementById('three').style.display = 'none';
	}
	else if(s == 'two')
	{
		document.getElementById('one').style.display = 'none';
		document.getElementById('two').style.display = '';
		document.getElementById('three').style.display = 'none';
	}
	else if(s == 'three')
	{
		document.getElementById('one').style.display = 'none';
		document.getElementById('two').style.display = 'none';
		document.getElementById('three').style.display = '';
	}
}

function chkAllEmails(field)
{
	for(i = 0; i < document.utilityfrm.elements.length; i++)
	{
		if(document.utilityfrm.elements[i].type == "checkbox" && document.utilityfrm.elements[i].name == field)
		{
			document.utilityfrm.elements[i].checked = true;
		}
	}
}
function unchkAllEmails(field)
{
	for(i = 0; i < document.utilityfrm.elements.length; i++)
	{
		if(document.utilityfrm.elements[i].type == "checkbox" && document.utilityfrm.elements[i].name == field)
		{
			document.utilityfrm.elements[i].checked = false;
		}
	}
}

function checkUsers()
{
	var st;
	for(var i = 0; i < document.utilityfrm.users.length; i++)
	{
		if(document.utilityfrm.users[i].checked)
		{
			st = document.utilityfrm.users[i].value;
		}
	}

	if(!st)
	{
		alert('Select Users');
		return false;
	}
	return true;
}

/****** for textarea character count **********************/
maxL=500;
var bName = navigator.appName;
function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
	if (objCnt) {
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}
function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}

/***** user : checking for Request a Quote form *****/
function checkquoteform()
{
	var hostingtype = document.hostingquote.hidden_type.value;

	if(hostingtype == 'S')
	{
	
	}
	else if(hostingtype == 'D')
	{
	
	}
	else if(hostingtype == 'V')
	{
	
	}

	if(document.hostingquote.q_fname.value == '')
	{
		alert('Enter First Name');
		document.hostingquote.q_fname.focus();
		return false;
	}

	if(document.hostingquote.q_email.value == '')
	{
		alert('Enter Email Address');
		document.hostingquote.q_email.focus();
		return false;
	}
	
	if(!(document.hostingquote.q_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
		{
			alert('Enter valid email id');
			document.hostingquote.q_email.focus();
			return false;
		}

	if(document.hostingquote.security_code.value == '')
	{
		alert('Enter image code shown below');
		document.hostingquote.security_code.focus();
		return false;
	}
	return true;
}

/***** user : checking for Request a Quote form *****/
function checkDisableForm()
{
	var count = 0;

}

/******************** check all category**************************/
function checkAll()
{
	for(var i=1; i <= 35; i++)
	{
		if(document.Adbanner.elements['cat_'+i])
			document.Adbanner.elements['cat_'+i].checked=true;
	}
	document.getElementById('CeckCat').innerHTML = "&nbsp;<a href='javascript:void(0);' onclick='UncheckAll();'><u>Uncheck all</u></a>";	
}

function UncheckAll()
{
	for(var i=1; i <= 35; i++)
	{
		if(document.Adbanner.elements['cat_'+i])
			document.Adbanner.elements['cat_'+i].checked=false;
	}
	document.getElementById('CeckCat').innerHTML = "&nbsp;<a href='javascript:void(0);' onclick='checkAll();'><u>Check all</u></a>";	
}
/******************** get related article list for admin ************/
function ArticleAjax(fileurl,arttype,idname,editid,edittype)
{
	var xmlHttp;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	if(editid != '')
	{
		var url = fileurl+arttype+"&artid="+editid+"&arttype="+edittype;
	}
	else
	{
		var url = fileurl+arttype;
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById(idname).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

/******** for all articel page : display more*************/
function displaymore(artid,moreid)
{
	document.getElementById(artid).style.display = '';
	document.getElementById(moreid).innerHTML= "<a href='javascript:void(0);' onclick='nodisplaymore(\""+artid+"\",\""+moreid+"\")'>More [ - ]</a>";
}

function nodisplaymore(artid,moreid)
{
	document.getElementById(artid).style.display = 'none';
	document.getElementById(moreid).innerHTML= "<a href='javascript:void(0);' onclick='displaymore(\""+artid+"\",\""+moreid+"\")'>More [+]</a>";
}

/********* for listing page right side category display **************/
function ShowDedicatedCategory()
{
	document.getElementById("show1").style.display = "none";
	document.getElementById("show2").style.display = "";
	document.getElementById("show3").style.display = "none";
	document.getElementById("show1top").innerHTML= "<a href='javascript:void(0);' onclick='ShowSharedCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Shared Web Hosting</a>";
	document.getElementById("show2top").innerHTML= "<a href='javascript:void(0);' onclick='ShowVpsCategory();'><img src='http://www.hosting.rpa/images/minus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Dedicated Hosting</a>";
	document.getElementById("show3top").innerHTML= "<a href='javascript:void(0);' onclick='ShowVpsCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;VPS Web Hosting</a>";		
}

function ShowVpsCategory()
{
	document.getElementById("show1").style.display = "none";
	document.getElementById("show2").style.display = "none";
	document.getElementById("show3").style.display = "";
	document.getElementById("show1top").innerHTML= "<a href='javascript:void(0);' onclick='ShowSharedCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Shared Web Hosting</a>";
	document.getElementById("show2top").innerHTML= "<a href='javascript:void(0);' onclick='ShowDedicatedCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Dedicated Hosting</a>";
	document.getElementById("show3top").innerHTML= "<a href='javascript:void(0);' onclick='ShowSharedCategory();'><img src='http://www.hosting.rpa/images/minus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;VPS Web Hosting</a>";	
}

function ShowSharedCategory()
{
	document.getElementById("show1").style.display = "";
	document.getElementById("show2").style.display = "none";
	document.getElementById("show3").style.display = "none";
	document.getElementById("show3top").innerHTML= "<a href='javascript:void(0);' onclick='ShowVpsCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;VPS Web  Hosting</a>";
	document.getElementById("show2top").innerHTML= "<a href='javascript:void(0);' onclick='ShowDedicatedCategory();'><img src='http://www.hosting.rpa/images/plus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Dedicated Hosting</a>";	
	document.getElementById("show1top").innerHTML= "<a href='javascript:void(0);' onclick='ShowDedicatedCategory();'><img src='http://www.hosting.rpa/images/minus.gif' align='middle' class='padding_bottom10' alt='icon' />&nbsp;&nbsp;Shared Web Hosting</a>";	
}

/*********** Blank check for Quote Reply **********/
function quoteReplyCheck()
{
	if(document.frmQuote.quotereply.value == '')
	{
		alert('Please Enter Quote Reply');
		document.frmQuote.quotereply.focus();
		return false;
	}
	return true;
}
/********** Blank check for Message **********/
function messageCheck()
{
	if(document.frmUserMessage.user_message.value == '')
	{
		alert('Please Enter Message');
		document.frmUserMessage.user_message.focus();
		return false;
	}
	return true;
}

/****** ajax function for disable ********/
function QuoteDisable(disableurl,resultid)
{
	var xmlHttp;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	var url = disableurl;
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(resultid == 'floatdiv')
			{
				document.getElementById(resultid).style.display='none';
			}
			else
			{
				document.getElementById(resultid).style.display='';
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function setLayerPosition(showid,hideid) 
{
	var shadow = document.getElementById(showid);
	var question = document.getElementById(hideid);
	
	shadow.style.width = "1034px";
	shadow.style.height = document.body.clientHeight + "px";
	
	shadow = null;
	question = null;
}

function showLayer(showid,hideid,quoteid,quoteemail)
{
	setLayerPosition(showid,hideid);
	var shadow = document.getElementById(showid);
	var question = document.getElementById(hideid);
	document.getElementById('qid').value = quoteid;
	document.getElementById('toEmailId').innerHTML=quoteemail;

	shadow.style.display = "block"; 
	question.style.display = "block";

	shadow = null;
	question = null;
}

function hideLayer(showid,hideid)
{
	var shadow = document.getElementById(showid);
	var question = document.getElementById(hideid);

	shadow.style.display = "none"; 
	question.style.display = "none";

	shadow = null;
	question = null; 
}

/***** chk email ****/
function ChkingEmailValidation(formname)
{
	if(formname.request_email.value == '')
	{
		alert('Enter Email Id');
		formname.request_email.focus();	
		return false;
	}
	else if(!(formname.request_email.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/)))
	{
		alert('Enter valid email id');
		formname.request_email.focus();
		return false;
	}
	
	return true;
}

function mopen(id,baseUrl,menulength)
{
	mcancelclosetime();

	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	ddmenuitem = document.getElementById(id);

	ddmenuitem.style.visibility = 'visible';

}
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
document.onclick = mclose; 

function requestToDisable(review_id,baseUrl)
{
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4)
        {
            document.getElementById('requestfrm_'+review_id).innerHTML=xmlhttp.responseText;
        }
    }

	var url=baseUrl+"/user/user_requestAdmin.php";
	url=url+"?review_id="+review_id;

    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);

    document.getElementById('requestfrm_'+review_id).style.display = '';
}

function closeRequestForm(id)
{
    document.getElementById('requestfrm_'+id).style.display = 'none';
}

function chkhelpdeskfrm()
{
    var chkrad = 0;
    for(var i=0; i < document.helpdeskfrm.quesType.length; i++)
    {
        if(document.helpdeskfrm.quesType[i].checked)
        {
           chkrad = 1;
            break;
        }
        else
        {
           chkrad = 0;
        }
    }
    if(chkrad == 0)
    {
        alert('Please specify if you have a technical issue or having a better idea');
        document.helpdeskfrm.quesType[0].focus();
        return false;
    }

    if(document.helpdeskfrm.txtQuery.value == '')
    {
        alert('please write your ideas or issues to post.');
        document.helpdeskfrm.txtQuery.focus();
        return false;
    }
    return true;
}

function moreItems()
{
    document.getElementById('more_items').style.visibility = 'visible';
}

function closeMoreItems()
{
    document.getElementById('more_items').style.visibility = 'hidden';
}

function topWebHosts(div_id)
{
    if(div_id == 'shared_host')
    {
        document.getElementById('shared_host').style.display = '';
        document.getElementById('dedicated_host').style.display = 'none';
        document.getElementById('vps_host').style.display = 'none';

        document.getElementById('shared_menu').className = 'active';
        document.getElementById('dedicated_menu').className = '';
        document.getElementById('vps_menu').className = '';
    }
    else if(div_id == 'dedicated_host')
    {
        document.getElementById('shared_host').style.display = 'none';
        document.getElementById('dedicated_host').style.display = '';
        document.getElementById('vps_host').style.display = 'none';

        document.getElementById('shared_menu').className = '';
        document.getElementById('dedicated_menu').className = 'active';
        document.getElementById('vps_menu').className = '';
    }
    else if(div_id == 'vps_host')
    {
        document.getElementById('shared_host').style.display = 'none';
        document.getElementById('dedicated_host').style.display = 'none';
        document.getElementById('vps_host').style.display = '';

        document.getElementById('shared_menu').className = '';
        document.getElementById('dedicated_menu').className = '';
        document.getElementById('vps_menu').className = 'active';
    }

}

function planEnableDisable(planStatus)
{
    if(planStatus == 'D')
        document.getElementById('plan_status').style.display='';
    else
        document.getElementById('plan_status').style.display='none';
}

function companyEnableDisable(companyStatus)
{
	if(companyStatus == 0)
		document.getElementById('company_status').style.display='';
	else
		document.getElementById('company_status').style.display='none';
}

function isNumberChk(val)
{
    var charCode = (val.which) ? val.which : event.keyCode;
    
    if((charCode>=48 && charCode<=57) || charCode==46 || charCode==8)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function sEnableOnOther(element_id)
{
    var sel = document.getElementById(element_id);
    var element_value = sel.options[sel.selectedIndex].value;

    var textbox=element_id.substring(4);

    var txtelement = document.getElementsByName(textbox)[0];

    if(element_value == 0)
    {
        txtelement.disabled=false;
        if(txtelement.value == ' if other pls specify here ')
            txtelement.className='width150 gray999 textbox_new';
        else
            txtelement.className='width150 black_text textbox_new';
    }
    else
    {
        txtelement.disabled=true;
        txtelement.className='width150 gray999 textbox_new';
    }
}

function chkTextBox(txtElement)
{
    if(document.getElementById(txtElement).value == ' if other pls specify here ')
    {
        document.getElementById(txtElement).value = '';
        document.getElementById(txtElement).className = 'width150 black_text textbox_new';
    }
}

function defaultTextBox(txtElement)
{
    if(document.getElementById(txtElement).value == '')
    {
        document.getElementById(txtElement).value = ' if other pls specify here ';
        document.getElementById(txtElement).className = 'width150 gray999 textbox_new';
    }
}

function chknewsfrm()
{
	if(document.newsfrm.txttitle.value == '')
	{
		alert('Please provide a News Title');
		document.newsfrm.txttitle.focus();
		return false;
	}

	if(document.newsfrm.txtdescription.value == '')
	{
		alert('Please provide the News Descriptions');
		document.newsfrm.txtdescription.focus();
		return false;
	}

	return true;
}

function countChars(txtElement, charLimit, charElement)
{
	if(txtElement.value.length > charLimit)
	{
		txtElement.value = txtElement.value.substring(0, charLimit);
		return false;
	}
	else
	{
		document.getElementById(charElement).innerHTML = charLimit - txtElement.value.length;
	}
}

function sendBasicQuote()
{
    var xmlHttp;
    try
    {
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

    document.getElementById('processfrm').style.display='';
    document.getElementById('error_msg').style.display='none';

    var username = document.quoterequestfrm.txtusername.value;
    var useremail = document.quoterequestfrm.txtuseremail.value;
    var desc = document.quoterequestfrm.txtdescription.value;

    var url = "/basicQuote.php";
    var params = "username="+username+"&useremail="+useremail+"&desc="+desc;

    xmlHttp.open("POST", url, true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");


    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            document.getElementById('processfrm').style.display='none';

            if(xmlHttp.responseText != 'Quote Request Sent')
			{
                document.getElementById('error_msg').style.display='';
                document.getElementById('error_msg').innerHTML=xmlHttp.responseText;
			}
			else
			{
				document.quoterequestfrm.txtusername.value='';
				document.quoterequestfrm.txtuseremail.value='';
				document.quoterequestfrm.txtdescription.value='';

				document.getElementById('basicQuoteRequest').innerHTML='Thank you for submitting a web hosting quote. Your quote request has been sent to our web hosting providers who will contact you within 1-5 business days.';
			}

/*            document.getElementById('basicQuoteRequest').innerHTML=xmlHttp.responseText;*/
        }
    }

    xmlHttp.send(params);
}


function quickSearch(showSearch)
{
    if(showSearch == 'S')
    {
        document.getElementById('s_search').className = 'li_part quick_search_active width_70';
        document.getElementById('d_search').className = 'li_part quick_search width_70';
        document.getElementById('v_search').className = 'li_part quick_search width_70';
        document.getElementById('shared_search').style.display='';
        document.getElementById('dedicated_search').style.display='none';
        document.getElementById('vps_search').style.display='none';
    }
    else if(showSearch == 'D')
    {
        document.getElementById('s_search').className = 'li_part quick_search width_70';
        document.getElementById('d_search').className = 'li_part quick_search_active width_70';
        document.getElementById('v_search').className = 'li_part quick_search width_70';
        document.getElementById('shared_search').style.display='none';
        document.getElementById('dedicated_search').style.display='';
        document.getElementById('vps_search').style.display='none';
    }
    else if(showSearch == 'V')
    {
        document.getElementById('s_search').className = 'li_part quick_search width_70';
        document.getElementById('d_search').className = 'li_part quick_search width_70';
        document.getElementById('v_search').className = 'li_part quick_search_active width_70';
        document.getElementById('shared_search').style.display='none';
        document.getElementById('dedicated_search').style.display='none';
        document.getElementById('vps_search').style.display='';
    }
}


function cleanURL(qs,qstype)
{
    if(qstype == 's')
    {
        var saveBt='shared_search';
        var searchType='shared-hosting';
    }
    if(qstype == 'd')
    {
        var saveBt='dedicated_search';
        var searchType='dedicated-servers';
    }
    if(qstype == 'v')
    {
        var saveBt='vps_search';
        var searchType='vps-hosting';
    }
    var l=qs.elements.length;
    var u='/quicksearch?';
    for(var i = 0; i < l; i++)
    {
        var e=qs.elements[i];

        if(e.name!=saveBt && e.selectedIndex != '')
        {
            u=u+e.name+'='+e.options[e.selectedIndex].value+'&';
        }
    }
    u=u+'type='+searchType;
    window.location.replace(u);
    return false;

}

function shortingForm(short,urlChange,companyPlan,sortPlan,quickSearch)
{
    u='';
    (short.value != '')
        document.sortList.submit();

    if(urlChange == 'Y')
    {
        if(document.sortList.sort.value == 'yearly_price' || document.sortList.sort.value == 'price')
        {
            var ordType='asc';    
        }
        else
        {
            var ordType='desc';    
        }
        
        if(companyPlan == 'V' || companyPlan == 'D')
            u='?plan='+companyPlan+'&sort='+document.sortList.sort.value+'&ord='+ordType;
        else if(sortPlan == 'S')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
				u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else if(sortPlan == 'D')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
	            u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else if(sortPlan == 'V')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
	            u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else if(quickSearch == 'Y')
        {
            var qsearchUrl=document.getElementById('sortingUrl').innerHTML;
            u=qsearchUrl.replace('&amp;','&')+'&sort='+document.sortList.sort.value+'&ord='+ordType;
        }
        else
            u='?sort='+document.sortList.sort.value+'&ord='+ordType;

        window.location.replace(u);
        return false;
    }
	else if(urlChange == 'YR')
	{
		var ordType=document.sortList.ord.value;

        if(sortPlan == 'S')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
				u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else if(sortPlan == 'D')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
	            u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else if(sortPlan == 'V')
		{
			var sUrl=document.sortList.searchUrl.value;
			var bUrl=document.sortList.basicSearchUrl.value;
			if(sUrl != '')
	            u=bUrl+'?'+sUrl+'&sort='+document.sortList.sort.value+'&ord='+ordType;
			else
	            u=bUrl+'?sort='+document.sortList.sort.value+'&ord='+ordType;
		}
        else
            u='?sort='+document.sortList.sort.value+'&ord='+ordType;

        window.location.replace(u);
        return false;
	}
}

function isNumberChkWithoutDot(val)
{
    var charCode = (val.which) ? val.which : event.keyCode;
    
    if((charCode>=48 && charCode<=57) || charCode==8)
    {
        return true;
    }
    else
    {
        return false;
    }
}

function getStates(countryId)
{
	var xmlHttp;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
 	var url = "/stateList.php?country_id="+countryId;
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById("select_state").innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function clearParam(paramKey,baseUrl,subUrl)
{
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
	var url=baseUrl+'/clearSearchParam.php';
	var params='paramKey='+paramKey;

	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			var redirectUrl=baseUrl+subUrl+xmlhttp.responseText;
			window.location=redirectUrl;
		}
	}

	xmlhttp.open("post",url,true);
 	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(params);
}

function markQuote(readIds,quoteId,hType,markAs,baseUrl)
{
	var chkbox='';

	if(hType == 'S')
		var fName='frmSharedQuote';
	else if(hType == 'D')
		var fName='frmDedicatedQuote';
	else if(hType == 'V')
		var fName='frmVpsQuote';

    var xmlhttp;
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

	var url=baseUrl+'/markQuote.php';
	var params='readIds='+readIds+'&quoteId='+quoteId+'&hType='+hType+'&markAs='+markAs;

	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			var updatedIds = xmlhttp.responseText;

			var ele = document.getElementsByTagName('input');
		
			for(var i=0;i<ele.length;i++)
			{
				if(ele[i].type=='checkbox')
				{
					ele[i].value=updatedIds;
				}
			}

			if(document.getElementById('qr_'+quoteId).className == 'quote_unread')
			{
				document.getElementById('qr_'+quoteId).className='quote_read';

				chkbox = "<input type=\"checkbox\" onclick=\"markQuote(this.value,'"+quoteId+"','"+hType+"','U','"+baseUrl+"')\" name=\"flag"+quoteId+"\" value=\""+updatedIds+"\" />";
				chkbox += ' Mark as Unread';
			}
			else if(document.getElementById('qr_'+quoteId).className == 'quote_read')
			{
				document.getElementById('qr_'+quoteId).className='quote_unread';

				chkbox = "<input type=\"checkbox\" onclick=\"markQuote(this.value,'"+quoteId+"','"+hType+"','R','"+baseUrl+"')\" name=\"flag"+quoteId+"\" value=\""+updatedIds+"\" />";
				chkbox += ' Mark as Read';
			}

			document.getElementById('chk_'+quoteId).innerHTML=chkbox;
		}
	}

	xmlhttp.open("post",url,true);
 	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", params.length);
    xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(params);
}

function articleCategory(articleId,adminUrl)
{
	var catLength = document.getElementById('selCategory').length;
	var i = 0;
	var xmlHttp;

	catSelected="";

	for(i=0;i<catLength;i++)
	{
		if(document.category.selCategory[i].selected)
			catSelected = catSelected + document.category.selCategory[i].value + ",";
	}

	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
    var url = adminUrl+"/relatedArticleList.php";

	if(articleId != '')
	    var params = "articleId="+articleId+"&catSelected="+catSelected;
	else
	    var params = "catSelected="+catSelected;

    xmlHttp.open("POST", url, true);

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('related_art').innerHTML=xmlHttp.responseText;
		}
	}

    xmlHttp.send(params);
}
