//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 showPic(file)
{
	var win=window.open(site_path+'source/show_photos.php?file='+file,'photo','toolbar:0,status=0,scrollbars=1,width=50,height=50')	;	
}

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 rowover(obj)
{
	obj.className = "rowover" ;
}

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

function showDwnOpt(num)
{
	for(i=1;i<=3;i++)
	{
		var div = $('itemDwnFileDiv'+i)
		Element.hide(div);
	}

	var div = $('itemDwnFileDiv'+num)
	Element.show(div);

}

function showPinOpt(num)
{
	for(i=1;i<=2;i++)
	{
		var div = $('itemPinCodesDiv'+i)
		Element.hide(div);
	}

	var div = $('itemPinCodesDiv'+num)
	Element.show(div);

}
 function voidit()
 {
	 return;
 }