//Ajax To show image galler of Home Page
var xmlHttp

function changemysrc(img)
{
			document.getElementById('hidepage2').style.visibility = 'visible';

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getthumbnails.php";
	url=url+"?action=changemysrc";
	url=url+"&img="+img;
	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function stateChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("txtHint2").innerHTML=xmlHttp.responseText;
		document.getElementById('hidepage2').style.visibility = 'hidden';
	}
}

function showCustomer(start)
{
	document.getElementById('hidepage2').style.visibility = 'visible';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="getthumbnails.php";
	url=url+"?start="+start;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}
function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
		document.getElementById('hidepage2').style.visibility = 'visible';
	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
	  // Internet Explorer
		try
	    {
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
		catch (e)
	    {
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	}
	return xmlHttp;
}

//Function to Validate SearchForm
function chksearchform()
{
	if (document.searchform.keywords.value == "")
	{
		alert("Please fill in keywords to be searched.");
	}
	else
	{
		document.searchform.submit();
	}
}

//Function to PreLoad Images
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];}}
}

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_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 for Div Scroll--------------------------------------------
function init_dw_Scroll() {
   var wndo = new dw_scrollObj('wn', 'lyr1');
   wndo.setUpScrollControls('scrollLinks');
}


//-----------------------------Function to validate enquiry form--------------------------------------------
function chkenquiryform()
{
	var msg = "";
	if (document.enquiryform.name.value == "") { msg = msg + "Name\n";}
	if (document.enquiryform.company.value == "") { msg = msg + "Company\n";}
	if (document.enquiryform.email.value == "") { msg = msg + "Email\n";}
	else 
	{
		var houseReegxp = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/;
		if (houseReegxp.test(document.enquiryform.email.value) == false)
		{
			msg = msg + "Invald Email Address\n";
		}
	}
	if (document.enquiryform.mobile.value == "") { msg = msg + "Mobile\n";}
	if (document.enquiryform.phone.value == "") { msg = msg + "Phone\n";}
	if (document.enquiryform.address.value == "") { msg = msg + "Address\n";}
	if (document.enquiryform.city.value == "") { msg = msg + "City\n";}
	if (document.enquiryform.state.value == "") { msg = msg + "State\n";}
	if (document.enquiryform.country.value == "") { msg = msg + "Country\n";}
	if (document.enquiryform.pincode.value == "") { msg = msg + "Pincode\n";}
	if (document.enquiryform.msg.value == "") { msg = msg + "Message\n";}
	
	if (msg != "")
	{
		alert("Please fill in following fields-\n"+msg);
		return false;
	}

}

//-----------------------------------------------------------------------------
//Pagination dropdown redirection for products.php
//-----------------------------------------------------------------------------
function redirect_pg(url)
{
	document.location=url+'&pageno='+document.getElementById('redirectid').value;
}








