//Title cartfunctions.js
//Author : Harish Chauhan
//Date   : 24 Aug,2004
//This file contains the functions for cart
//at client side with the help of java script.

//  this function checks the email format is correct or not
//  and return true or false accordingly.
<!--
function compareProd()
{
	thispage=location.href;
	mypage=thispage.split(/\?/);
	thispage=mypage[0];
	
	prodids="";
	coma="";
	for(j=0;j<document.forms.length;j++)
	{
		theForm=document.forms[j];
		for(i=0;i<theForm.elements.length;i++)
		{
			if(theForm.elements[i].name=='chkCompProd')
			{
				if(theForm.elements[i].checked)
				{
					prodids = prodids + coma + theForm.elements[i].value;
					coma=",";
				}
			}
		}
	}
	
	if(prodids!="")
		location.href=thispage+"?mode=comp&prodids="+prodids+"&cat=<?=$_GET['cat']?>";
	return false;
}

function UPSOrderTrack(TrackingNo)
{
	track=TrackingNo.split(/,/);
	var trackstr='';
	for(i=1;i<=track.length && i<=5;i++)
		trackstr+="InquiryNumber"+i+"="+track[i-1]+"&";
	var strURL = "http://wwwapps.ups.com/WebTracking/OnlineTool?" + trackstr + "UPS_HTML_License=8BD2C53DF22E8830&TypeOfInquiryNumber=T&IATA=us&Lang=eng";
	wndUPSOrderTrack = window.open(strURL, "UPSOrderTrack", "menubar,scrollbars,resizeable,height=625,width=750");
	wndUPSOrderTrack.focus();
}

function showPic(file)
{
	var win=window.open('<?=$_SITE_PATH?>/includes/show_photos.php?file='+file,'photo','toolbar:0,status=0,scrollbars=1')	;	
}

function showBigPic(file)
{
	var win=window.open('<?=$_SITE_PATH?>/cart/show_photos.php?file='+file,'photo','toolbar:0,status=0,scrollbars=1')	;	
}

function resizeWinToPic(margin)
{
   var NS = (navigator.appName=="Netscape")?true:false; 
   iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
   iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
   iWidth = document.images[0].width - iWidth; 
   iHeight = document.images[0].height - iHeight; 
  
   window.resizeBy(iWidth+margin, iHeight+margin); 
   
   self.focus(); 
}

if(!document.getElementById)
{
  if(document.all)
  {
	document.getElementById=function()
	{
		if(typeof document.all[arguments[0]]!="undefined")
		    return document.all[arguments[0]];
	    else
			return null;
	}
  }
  else if(document.layers)
  {
	 document.getElementById=function()
	 {
		if(typeof document[arguments[0]]!="undefined")
		    return document[arguments[0]];
	    else
			return null;
	}
  }
}


function checkall(obj,objName,myform)
{
	for(i=0;i<document.forms[myform].elements.length;i++)
	{
		if(document.forms[myform].elements[i].name==objName)
			if(obj.checked)		
				document.forms[myform].elements[i].checked=true;
			else
				document.forms[myform].elements[i].checked=false;
	}
}

function checkall2(obj,objName,myform)
{
	for(i=0;i<document.forms[myform].elements.length;i++)
	{
		if(document.forms[myform].elements[i].name.indexOf(objName)>=0)
			if(obj.checked)		
				document.forms[myform].elements[i].checked=true;
			else
				document.forms[myform].elements[i].checked=false;
	}
}

function openRem(data)
{
	var win=window.open('','mywin','toolbar=0,status=0,height=300,width=450,scrollbars=yes');
	win.document.write("<p align='justify' style='font-family:verdana;font-size:11px;'>"+data+"<\/p><p align='center'><a href='javascript:window.close()'>Close<\/a>");
	win.moveTo(win.screen.width/2-200,win.screen.height/2-200);
}

function randomString(string_length,type)
{
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	
	if(type=="NUMBER")
		chars = "0123456789";
	else if(type=="STRING")
		chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	else if(type=="UPPER_STRING")
		chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZ";
	else if(type=="LOWER_STRING")
		chars = "abcdefghijklmnopqrstuvwxtz";

	if(string_length == null || string_length=='undefined')
		string_length = 8;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}

function fillRandom(obj,prefix,string_length,type)
{
	obj.value=prefix+randomString(string_length,type);
}

function printIt(prndata)
{
	var mywin;
	mywin=window.open('','prnwin','toolbar=0,status=0,width=650,height=550,scrollbars=yes,resizable=yes');
	mywin.document.write("<html><head><\/head><body>");
	mywin.document.write(prndata);
	mywin.document.write("<\/body><script>window.print();<\/script><\/html>");
	mywin.location.reload();
}
function rowover(obj)
{
	obj.className = "rowover" ;
}

function rowout(obj,cls)
{
	obj.className = cls ;
}

//-->