// JavaScript Document
function main()
{
//	setTimeout("document.getElementById('tableflash').innerHTML=document.getElementById('tablemain').innerHTML",2500);
	setTimeout("window.location='index1.asp'",4500);
}

function imgchg(id,no)
{
	for (id_t=1;id_t<=no;id_t++) 
	{
  	document.getElementById('img'+id_t).className='highlightit';
	}
 	document.getElementById('img'+id).className='highlightit_t';
	if (document.getElementById('text_msg'))
	{
		id_n='pic'+id;
		document.getElementById('text_msg').innerHTML=document.getElementById(id_n).alt;
	}
}

step=3;

function toTop(id)
{ 
document.getElementById(id).scrollTop=0 
} 

function scrollDivDown(id)
{ 
document.getElementById(id).scrollTop+=step 
timerDown=setTimeout("scrollDivDown('"+id+"')",10) 
} 

function scrollDivLeft(id)
{ 
document.getElementById(id).scrollLeft-=step 
timerUp=setTimeout("scrollDivLeft('"+id+"')",10) 
} 

function scrollDivRight(id)
{ 
document.getElementById(id).scrollLeft+=step 
timerDown=setTimeout("scrollDivRight('"+id+"')",10) 
} 

function scrollDivUp(id)
{ 
document.getElementById(id).scrollTop-=step 
timerUp=setTimeout("scrollDivUp('"+id+"')",10) 
} 

function toBottom(id)
{ 
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight 
} 

function toPoint(id)
{ 
document.getElementById(id).scrollTop=100 
} 

function connect()
{
	var xmlHttp = false;
	try 
	{
  		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
  		try 
		{
    		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  		} 
		catch (e2) 
		{
    		xmlHttp = false;
  		}
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
  		xmlHttp = new XMLHttpRequest();
	}
	if(xmlHttp)
	return xmlHttp;
}

function loadpage(url, containerid, exeme)
{
	//alert(url)
	var xmlHttp=new Array();
	xmlHttp=connect();
	xmlHttp.open("GET", url);
	xmlHttp.onreadystatechange=function()
	{
	if (xmlHttp.readyState == 4 && (xmlHttp.status==200 || window.location.href.indexOf("http")==-1))
		{
			data=xmlHttp.responseText;
			document.getElementById(containerid).innerHTML=data;
			if (exeme!=null && exeme!="")
			{
				setTimeout(exeme, 1); 
			}
		}
	}
    xmlHttp.send(null);
}

function showdiv(id,no)
{
op=document.getElementById(id).style.display;
if (op=='none')
{
	for (id_t=1;id_t<=no;id_t++) 
	{
 		document.getElementById('d'+id_t).style.display='none';
	}
	document.getElementById(id).style.display='block';
}
}

function hidediv(id)
{
document.getElementById(id).style.display='none';
}
function swapdata(id)
{
	document.getElementById('Product_Details').innerHTML=document.getElementById('P'+id).innerHTML;
}

function chkcartadditem(p_id,b_id,c_id)
{

	txt=document.getElementById("prd_color").value
	if ((txt==null)||(txt==""))
	{
		alert("Please Select the Product Color");
		document.getElementById("prd_color").focus();
		return false;
	}

	txt=document.getElementById("prd_size").value
	if ((txt==null)||(txt==""))
	{
		alert("Please Select the Product Size");
		document.getElementById("prd_size").focus();
		return false;
	}

	txt=document.getElementById("prd_qty").value
	if (txt=="0")
	{
		alert("Please Select the Quantity");
		document.getElementById("prd_qty").focus();
		return false;
	}

//following is with prd_price which is total cost of the items commented
//		loadpage('addtocart.asp?uid=1&cart_id='+c_id+'&prd_id='+p_id+'&prd_color='+document.getElementById('prd_color').value+'&prd_size='+document.getElementById('prd_size').value+'&prd_qty='+document.getElementById('prd_qty').value+'&prd_price='+document.getElementById('prd_price').value+'&currency_type='+document.getElementById('currency_type').value+'&comments='+document.getElementById('comments').value,'dcart','showcart('+p_id+','+b_id+')')

//following is with unitprice which is price of the item is activated
		loadpage('addtocart.asp?uid=1&cart_id='+c_id+'&prd_id='+p_id+'&prd_color='+document.getElementById('prd_color').value+'&prd_size='+document.getElementById('prd_size').value+'&prd_qty='+document.getElementById('prd_qty').value+'&prd_price='+document.getElementById('unit_price').value+'&currency_type='+document.getElementById('currency_type').value+'&comments='+document.getElementById('comments').value,'dcart','showcart('+p_id+','+b_id+')')

}

function showcart(p_id,b_id)
{
	window.location='anita_dongre_shop_cart.asp?p_id='+p_id+'&b_id='+b_id
}


function settrdiv(trdiv,st)
{

if (st==1)
{
	if(document.getElementById('dtmp').innerHTML.length>0)
	{
		document.getElementById('btncarteditcancel').click();
	}
	document.getElementById('dtmp').innerHTML=document.getElementById(trdiv).innerHTML;
}

if (st==2)
{
	if(document.getElementById('dtmp').innerHTML.length>0)
	{
		document.getElementById(trdiv).innerHTML=document.getElementById('dtmp').innerHTML
		document.getElementById('dtmp').innerHTML='';
	}
}
	
}



function chkshippingdtl(p_id,b_id,c_id)
{

	txt=document.getElementById("email").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the email address for sign in");
		document.getElementById("email").focus();
		return false;
	}


	txt=document.getElementById("password").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the password");
		document.getElementById("password").focus();
		return false;
	}

	txt=document.getElementById("first_name").value
	if (txt=="0")
	{
		alert("Please mention the First Name");
		document.getElementById("first_name").focus();
		return false;
	}

	txt=document.getElementById("address").value
	if (txt=="0")
	{
		alert("Please mention the Address");
		document.getElementById("address").focus();
		return false;
	}

	txt=document.getElementById("city").value
	if (txt=="0")
	{
		alert("Please mention the City");
		document.getElementById("city").focus();
		return false;
	}


	txt=document.getElementById("state").value
	if (txt=="0")
	{
		alert("Please mention the State");
		document.getElementById("state").focus();
		return false;
	}

	txt=document.getElementById("pincode").value
	if (txt=="0")
	{
		alert("Please mention the Pin Code");
		document.getElementById("pincode").focus();
		return false;
	}


	txt=document.getElementById("country").value
	if (txt=="0")
	{
		alert("Please mention the Country");
		document.getElementById("country").focus();
		return false;
	}

	//loadpage('anita_dongre_shipping_save.asp?uid=1&email='+document.getElementById('email').value+'&password='+document.getElementById('password').value+'&first_name='+document.getElementById('first_name').value+'&last_name='+document.getElementById('last_name').value+'&address='+document.getElementById('address').value+'&city='+document.getElementById('city').value+'&state='+document.getElementById('state').value+'&pincode='+document.getElementById('pincode').value+'&country='+document.getElementById('country').value+'&phone='+document.getElementById('phone').value,'dcart')

	document.frmship.action='anita_dongre_shipping_save.asp';	document.frmship.submit();	

}


/*
function validate_email(email)
{
// regexp for a valid email address
regexp = "^(['_a-z0-9-]+)(\.['_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,5})$";

return (eregi(regexp, email) > 0);
	} 
*/


function chknewcust()
{
	txt=document.getElementById("n_email").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the email address for sign in");
		document.getElementById("n_email").focus();
		return false;
	}
	
	txt=document.getElementById("pwd").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the password");
		document.getElementById("pwd").focus();
		return false;
	}
	txt=document.getElementById("pwd1").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the confirm password");
		document.getElementById("pwd1").focus();
		return false;
	}
	txt=document.getElementById("pwd").value
	txt1=document.getElementById("pwd1").value
	if (txt!=txt1)
	{
		alert("Password and Confirm password must be same");
		document.getElementById("pwd1").focus();
		return false;
	}


	loadpage('chksignin.asp?n_email='+document.getElementById("n_email").value+'&pwd='+document.getElementById("pwd").value+'&pwd1='+document.getElementById("pwd1").value+'&btnsignin='+document.getElementById("btnsignin").value,'dtooltip','gotopg()')

/*
	document.frmsign.action="anita_dongre_shipping.asp"
	document.frmsign.method="post"
	document.frmsign.submit()
*/
}

function chksignin()
{
	txt=document.getElementById("s_email").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the email address for sign in");
		document.getElementById("s_email").focus();
		return false;
	}
	
	txt=document.getElementById("s_pwd").value
	if ((txt==null)||(txt==""))
	{
		alert("Please mention the password");
		document.getElementById("s_pwd").focus();
		return false;
	}

	loadpage('chksignin.asp?s_email='+document.getElementById("s_email").value+'&s_pwd='+document.getElementById("s_pwd").value+'&btnsignin='+document.getElementById("btnsignin").value,'dtooltip','gotopg()')
}


function gotopg()
{
	if (document.getElementById("signin").value=='true' && document.getElementById("user_id").value!='')
	{
		if(document.getElementById('logst').value=="")
		{
			document.frmsign.action="anita_dongre_shipping.asp"
		}	
		else
		{
			document.frmsign.action="anita_dongre_shop_and.asp?p_id=1"
		}
		document.frmsign.method="post"
		document.frmsign.submit()
	}

	if (document.getElementById("signin").value=='false' && document.getElementById("user_id").value=='')
	{
		document.frmsign.action="anita_dongre_shipping.asp"
		document.frmsign.method="post"
		document.frmsign.submit()
	}
}