// JavaScript Document
	
var Site_Name="http://www.nemotile.com/"; 
   
function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()


}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}

function Get_gallery_Page(catid,total,pg)
{

	document.getElementById("Show_gallery").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_tilegallery.php?id="+catid+"&pg="+pg+"&total="+total;
	
	xmlHttp.onreadystatechange=stateGet_gallery_Page;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateGet_gallery_Page() 
{ 
	
	if (xmlHttp.readyState==4)
	{ 		

		document.getElementById("Show_gallery").innerHTML=xmlHttp.responseText;
	}
}
//Search paging
function Get_gallery_Page_srch(catid,total,pg)
{
	document.getElementById("Show_gallery").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttp_SRCHPAGE=GetXmlHttpObject();
	if (xmlHttp_SRCHPAGE==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_tilegallerysrch.php?id="+catid+"&pg="+pg+"&total="+total;
	
	xmlHttp_SRCHPAGE.onreadystatechange=stateGet_gallery_Page_srch;
	xmlHttp_SRCHPAGE.open("GET",url,true);
	xmlHttp_SRCHPAGE.send(null);
} 

function stateGet_gallery_Page_srch() 
{ 
	
	if (xmlHttp_SRCHPAGE.readyState==4)
	{ 		
		
		document.getElementById("Show_gallery").innerHTML=xmlHttp_SRCHPAGE.responseText;
	}
}
//My New Function
function LOAD_ALL_TABS(scatid)
{

	document.getElementById("LOAD_ALL_TABS_ID").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpLOAD_ALL_TABS=GetXmlHttpObject();
	if (xmlHttpLOAD_ALL_TABS==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_alltabs.php?id="+scatid;
	
	xmlHttpLOAD_ALL_TABS.onreadystatechange=stateGet_gallery_PageLOAD_ALL_TABS;
	xmlHttpLOAD_ALL_TABS.open("GET",url,true);
	xmlHttpLOAD_ALL_TABS.send(null);
} 

function stateGet_gallery_PageLOAD_ALL_TABS() 
{ 	
	if (xmlHttpLOAD_ALL_TABS.readyState==4)
	{ 		
		document.getElementById("LOAD_ALL_TABS_ID").innerHTML=xmlHttpLOAD_ALL_TABS.responseText;
	}
}

function SWA_PRODUCT_GET(scatid,pro_type)
{
	
	document.getElementById("Div_Swaches_DIV").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpSWA_PRODUCT_GET=GetXmlHttpObject();
	if (xmlHttpSWA_PRODUCT_GET==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_swa_alltabs.php?id="+scatid+"&pro_type="+pro_type;
	
	xmlHttpSWA_PRODUCT_GET.onreadystatechange=stateGet_SWA_PRODUCT_GET;
	xmlHttpSWA_PRODUCT_GET.open("GET",url,true);
	xmlHttpSWA_PRODUCT_GET.send(null);
} 

function stateGet_SWA_PRODUCT_GET() 
{ 	
	if (xmlHttpSWA_PRODUCT_GET.readyState==4)
	{ 
		document.getElementById("Div_Swaches_DIV").innerHTML=xmlHttpSWA_PRODUCT_GET.responseText;
	}
}
//search div 
function SWA_PRODUCT_GET_SRCH(scatid,pro_type)
{
	
	document.getElementById("Div_Swaches_DIV").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpSWA_PRODUCT_GET_SRCH=GetXmlHttpObject();
	if (xmlHttpSWA_PRODUCT_GET_SRCH==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"srch_get_swa_alltabs.php?id="+scatid+"&pro_type="+pro_type;
	
	xmlHttpSWA_PRODUCT_GET_SRCH.onreadystatechange=stateGet_SWA_PRODUCT_GET_SRCH;
	xmlHttpSWA_PRODUCT_GET_SRCH.open("GET",url,true);
	xmlHttpSWA_PRODUCT_GET_SRCH.send(null);
} 

function stateGet_SWA_PRODUCT_GET_SRCH() 
{ 	
	if (xmlHttpSWA_PRODUCT_GET_SRCH.readyState==4)
	{ 
		//alert(xmlHttpSWA_PRODUCT_GET_SRCH.responseText);
		document.getElementById("Div_Swaches_DIV").innerHTML=xmlHttpSWA_PRODUCT_GET_SRCH.responseText;
	}
}
function Get_Show_Tab(i,tot)
{
	
	for (var j=1;j<=parseInt(tot);j++)
	{		
		
		document.getElementById("Div_Tab"+j).style.display='none';		
	}
	
	document.getElementById('hideseltab').value=i;
	document.getElementById('Div_Tab'+i).style.display='inline';
	
}

function Get_SignUp_Show()
{
	if (document.getElementById('Div_SignUp').style.display=='none')
		document.getElementById('Div_SignUp').style.display='inline';
	else 
		document.getElementById('Div_SignUp').style.display='none';	
}
function Get_Login_Show()
{
	if (document.getElementById('Div_Login').style.display=='none')
		document.getElementById('Div_Login').style.display='inline';
	else 
		document.getElementById('Div_Login').style.display='none';	
	
}
function Get_SignUp()
{

document.getElementById("SignUp_Commented").innerHTML="<img src='"+Site_Name+"images/loading_black.gif' alt='Loading...'>";
var signup_fname=document.getElementById("signup_fname").value;
var signup_lname=document.getElementById("signup_lname").value;
var signup_email=document.getElementById("signup_email").value;
var signup_emailc=document.getElementById("signup_emailc").value;
//var signup_password=document.getElementById("signup_password").value;
var signup_company=document.getElementById("signup_company").value;
var signup_descr=document.getElementById("signup_descr").value;
var signup_phone=document.getElementById("signup_phone").value;
var signup_fax=document.getElementById("signup_fax").value;
var signup_cell=document.getElementById("signup_cell").value;
var signup_addr1=document.getElementById("signup_addr1").value;
var signup_addr2=document.getElementById("signup_addr2").value;
var signup_city=document.getElementById("signup_city").value;
var signup_state=document.getElementById("signup_state").value;
var signup_zip=document.getElementById("signup_zip").value;
var signup_country =document.getElementById("signup_country").value;

var poststr="signup_fname="+signup_fname+
"&signup_lname="+signup_lname+
"&signup_email="+signup_email+
"&signup_emailc="+signup_emailc+
"&signup_company="+signup_company+
"&signup_descr="+signup_descr+
"&signup_phone="+signup_phone+
"&signup_fax="+signup_fax+
"&signup_cell="+signup_cell+
"&signup_addr1="+signup_addr1+
"&signup_addr2="+signup_addr2+
"&signup_city="+signup_city+
"&signup_state="+signup_state+
"&signup_zip="+signup_zip+
"&signup_country="+signup_country
;
//alert("hihi");
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 

xmlHttp.onreadystatechange=SignUpChanged 
var url=Site_Name+"getSignUp.php";
url=url+"?"+poststr;

xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function SignUpChanged() 
{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		
		document.getElementById("SignUp_Commented").innerHTML=xmlHttp.responseText;
		if (xmlHttp.responseText=='')
		{				
			document.getElementById('Div_Login').style.display = 'inline';
			document.getElementById('Div_After_Signup_Message').style.display = 'inline';
			
			document.getElementById('Div_SignUp').style.display = 'none';
		}
	} 
} 


function Get_Login()
{

document.getElementById("Login_Commented").innerHTML="<img src='"+Site_Name+"images/loading_black.gif' alt='Loading...'>";
var login_email=document.getElementById("login_email").value;
var login_pass=document.getElementById("login_pass").value;


var poststr="login_email="+login_email+"&login_pass="+login_pass;
//alert("hihi");
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 

xmlHttp.onreadystatechange=statLoginChanged 
var url=Site_Name+"getLogin.php";
url=url+"?"+poststr;

xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function statLoginChanged() 
{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		
		document.getElementById("Login_Commented").innerHTML=xmlHttp.responseText;
		if (xmlHttp.responseText=='')
		{				
			document.getElementById('Div_Login').style.display = 'none';			
			document.getElementById('Div_Browse_Prd').style.display = 'inline';
		}
	} 
} 

function SHOWSAMPLESDIV()
{
	document.getElementById('Div_Swaches_DIV').style.display='none';
	document.getElementById('Div_MY_SAMPLES').style.display='inline';
	
}
function SHOWSAMPLESDIV_SHIP()
{
	document.getElementById('Div_MY_SAMPLES').style.display='none';
	document.getElementById('Div_MY_SAMPLES_SHIP').style.display='inline';
	
}
function addtocartlink(pid,pro_type)
{
	//document.getElementById("Div_Swaches_DIV").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpaddtocartlink=GetXmlHttpObject();
	if (xmlHttpaddtocartlink==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"addtocart.php?id="+pid+"&pro_type"+pro_type;
	
	xmlHttpaddtocartlink.onreadystatechange=stateGETxmlHttpaddtocartlink;
	xmlHttpaddtocartlink.open("GET",url,true);
	xmlHttpaddtocartlink.send(null);
} 

function stateGETxmlHttpaddtocartlink() 
{ 	
	if (xmlHttpaddtocartlink.readyState==4)
	{ 
		//alert("Product has been added to cart successfully.");
		
	}
}
function removetocartlink(pid)
{
	//document.getElementById("Div_Swaches_DIV").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpremovetocartlink=GetXmlHttpObject();
	if (xmlHttpremovetocartlink==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"removetocart.php?id="+pid;
	
	xmlHttpremovetocartlink.onreadystatechange=stateGETxmlHttpremovetocartlink;
	xmlHttpremovetocartlink.open("GET",url,true);
	xmlHttpremovetocartlink.send(null);
} 

function stateGETxmlHttpremovetocartlink() 
{ 	
	if (xmlHttpremovetocartlink.readyState==4)
	{ 
		//alert("Product has been removed from cart successfully.");		
	}
}

function Get_SHIP()
{
	document.getElementById("SHIP_Commented").innerHTML="<img src='"+Site_Name+"images/loading_black.gif' alt='Loading...'>";
	var pakval="";
	var pakval1="";
	for (i = 1; i < 5; i++) 
	{		
		if (document.getElementById("SendVia"+i).checked==true) 
		{
			pakval=document.getElementById("SendVia"+i).value;	
		}
	}
	for (i = 1; i < 8; i++) 
	{		
		if (document.getElementById("ShippingMethod"+i).checked==true) 
		{
			pakval1=document.getElementById("ShippingMethod"+i).value;	
		}
	}
	
	var SendVia=pakval;
	var ship_acc_no=document.getElementById("ship_acc_no").value;
	var ShippingMethod=pakval1;
	var Comments=document.getElementById("Comments").value;	
	
	var poststr="SendVia="+SendVia+"&ship_acc_no="+ship_acc_no+"&ShippingMethod="+ShippingMethod+"&Comments="+Comments;
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	xmlHttp.onreadystatechange=statLoginChanged_SHIP
	var url=Site_Name+"getShip.php";
	url=url+"?"+poststr;	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function statLoginChanged_SHIP() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 		
		document.getElementById("SHIP_Commented").innerHTML=xmlHttp.responseText;
		if (xmlHttp.responseText=='')
		{				
			document.getElementById('Div_MY_SAMPLES_SHIP').style.display = 'none';			
			document.getElementById('Div_MY_SAMPLES_SHIP_FINAL').style.display = 'inline';
		}
	} 
}
function Get_Login_ShowCART()
{	
	document.getElementById('Div_MY_SAMPLES').style.display='none';	
	document.getElementById('Div_Login').style.display='inline';	
	
}
function SHOWSAMPLESDIV_Only()
{
	
	document.getElementById('Div_MY_SAMPLES').style.display='inline';
	
}
function SHOWSAMPLESDIV_OnlyHide()
{
	
	document.getElementById('Div_MY_SAMPLES').style.display='none';
	
}
function AFTERCARTADDSHOWCART()
{
	document.getElementById("Div_MY_SAMPLES").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpSWA_PRODUCT_GETPPP=GetXmlHttpObject();
	if (xmlHttpSWA_PRODUCT_GETPPP==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_allprods.php";
	
	xmlHttpSWA_PRODUCT_GETPPP.onreadystatechange=stateGet_AFTERCARTADDSHOWCART;
	xmlHttpSWA_PRODUCT_GETPPP.open("GET",url,true);
	xmlHttpSWA_PRODUCT_GETPPP.send(null);
} 

function stateGet_AFTERCARTADDSHOWCART() 
{ 	
	if (xmlHttpSWA_PRODUCT_GETPPP.readyState==4)
	{ 
		document.getElementById("Div_MY_SAMPLES").innerHTML=xmlHttpSWA_PRODUCT_GETPPP.responseText;
	}
	document.getElementById('Div_Swaches_DIV').style.display='none';
	document.getElementById('Div_MY_SAMPLES').style.display='inline';
}
function AFTERCARTADDSHOWCART1()
{
	document.getElementById("Div_MY_SAMPLES").innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttpSWA_PRODUCT_GETPPP1=GetXmlHttpObject();
	if (xmlHttpSWA_PRODUCT_GETPPP1==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_allprods.php";
	
	xmlHttpSWA_PRODUCT_GETPPP1.onreadystatechange=stateGet_AFTERCARTADDSHOWCART1;
	xmlHttpSWA_PRODUCT_GETPPP1.open("GET",url,true);
	xmlHttpSWA_PRODUCT_GETPPP1.send(null);
} 

function stateGet_AFTERCARTADDSHOWCART1() 
{ 	
	if (xmlHttpSWA_PRODUCT_GETPPP1.readyState==4)
	{ 
		document.getElementById("Div_MY_SAMPLES").innerHTML=xmlHttpSWA_PRODUCT_GETPPP1.responseText;
	}
	
	document.getElementById('Div_MY_SAMPLES').style.display='inline';
}

function SWA_TAB_SUBCAT(scatid,divnno)
{	
	for(j=1;j<=5;j++)
	{	
		document.getElementById("scatdvi_"+j).className="tab1_off";		
	}	
	document.getElementById("scatdvi_"+divnno).className="tab1_on";
	
	for(j1=1;j1<=5;j1++)
	{
		document.getElementById("scatdvi_"+j1).setAttribute("onMouseOut", "className='tab1_off';");
	}	
	document.getElementById("scatdvi_"+divnno).setAttribute("onMouseOut", "className='tab1_on';");
	
	for(j2=1;j2<=5;j2++)
	{
		document.getElementById("prodscroll"+j2).style.display="none";		
	}	
	document.getElementById("prodscroll"+divnno).style.display="inline";
	
	document.getElementById("prodscroll"+divnno).innerHTML="<img src='"+Site_Name+"images/loading.gif' alt='Loading...'>";
	xmlHttp_SCAT=GetXmlHttpObject();
	if (xmlHttp_SCAT==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	var url=""+Site_Name+"get_subcat_tabs.php?id="+scatid+"&divnno="+divnno;
	
	xmlHttp_SCAT.onreadystatechange=stateGet_SWA_TAB_SUBCAT;
	xmlHttp_SCAT.open("GET",url,true);
	xmlHttp_SCAT.send(null);
} 

function stateGet_SWA_TAB_SUBCAT() 
{
	if (xmlHttp_SCAT.readyState==4)
	{ 
		var praful=xmlHttp_SCAT.responseText;
		var newvalue=praful.split("##PRAFUL##");		
		document.getElementById("prodscroll"+newvalue[1]).innerHTML=newvalue[0];
		
	}
}

