
function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("div"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}


function validate_email(dbfrm,url,host) {

	if (dbfrm.name.value == '' || dbfrm.name.value == 'Your name here')
	{
		alert("Kindly Enter Your Name.");
		dbfrm.name.focus();
		return (false);
	}

	if(dbfrm.email.value == '')
	{
		alert("Please Enter The Email ID");
		dbfrm.email.focus();
		return (false);
	}

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(dbfrm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		dbfrm.email.focus();
		return (false);
	}

	if(url && host)
	{
	thisurl='http://'+host+url+'?action=Subscribe&email='+dbfrm.email.value+'&name='+dbfrm.name.value;
		window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=470,height=210');
		return false;
	}
	return false;
}


function getblank(this1)  {
	if (this1.value == "Your e-mail here") {
		this1.value = "";
	}
	return true;
}

function getblank1(this1)  {
	if (this1.value == "Your name here") {
		this1.value = "";
	}
	return true;
}

function createRequestObject(){
	var request_o;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_o = new XMLHttpRequest();
	}
	return request_o;
}

var http = createRequestObject();

function getcat(catid,host){
	http.open('get', 'http://'+host+'/search_cat.php?action=getcat&catid='+catid);
	http.onreadystatechange = handleAds;
	http.send(null);
}

function handleAds(){
	/* Make sure that the transaction has finished. The XMLHttpRequest object
		has a property called readyState with several states:
		0: Uninitialized
		1: Loading
		2: Loaded
		3: Interactive
		4: Finished */
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		document.getElementById('id1').innerHTML = response;
	}
}

function getProduct(host)
{
	var index=document.dataform.subcat.selectedIndex;
	var url=document.dataform.subcat.options[index].value;
	window.location.href='http://'+host+'/'+url+'/';
	return false;
}
