// JavaScript Document
var statecities=new Array();
//Script validation for displaying the City list in the given state
var lists = new Array();
var deliverytype = new Array();


function emptyList( box ) 
{
	
	while ( box.options.length ) box.options[0] = null;
}

function fillList( box, arr ) 
{
	for ( i = 0; i < arr[0].length; i++ ) 
	{
		
		option = new Option( arr[0][i], arr[0][i+1] );
		box.options[box.length] = option;
		i=i+1;
	}
	
	box.selectedIndex=0;
}


function changeCities(box) 
{
	list = statecities[box.options[box.selectedIndex].value];
	if(box.options[box.selectedIndex].value != "" && box.options[box.selectedIndex].value != "choose")
	{
		emptyList(box.form.txt_city);
		fillList( box.form.txt_city, list );
	}
}
function poplinks(url)
{
	newwindow=window.open(url,'ImageDisplay','height=400,width=600,align=center,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
xpos=xpos-(subobj.offsetWidth-curobj.offsetWidth);
xpos=632
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
//alert(xpos);
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
if(document.getElementById(subobj))
document.getElementById(subobj).style.display="none"
}

function OverlayScript(curobj, subobjstr, opt_position){
	return overlay(curobj, subobjstr, opt_position);	
}