function openURL(url, name, width, height)
{
	var str 	= "height=" + height + ",innerHeight=" + height + ",width=" + width + ",innerWidth=" + width + ",statusbar=no,scrollbars=no";
	var xpos	= (screen.availWidth-width)/2;
	var ypos	= (screen.availHeight-height)/2;
	newWindow 	= window.open(url,"pic",str);
	newWindow.focus();
	//return newWindow;	
}

function focusImage(iID)
{
	var img 	= $('productMainImage');
	var newImg  = new Element('img');
	newImg.setProperty('id','productMainImage');
	newImg.setProperty('src','../z_includes/inc_getAsset.php?type=image&id='+iID+'&width=185&height=145');
	newImg.setStyle('opacity',0);
	img.replaceWith(newImg);
	var success = false;
	do
	{
		success = positionImage.delay(1000);
	} while (success == false)
}

function populateDeliveryAddress()
{	
	$('delCustName1').value = $('custName1').value;
	$('delStreetAddr').value = $('streetAddr').value;
	$('delStreetAddr2').value = $('streetAddr2').value;	
	$('delCity').value = $('city').value;
	$('delPostCode').value = $('postCode').value;
	$('delCountry').value = $('country').value;
}

function positionImage()
{
	var height = 0;
	height = $('productMainImage').height;
	var width = 0;
	width = $('productMainImage').width;
	if (height == 0)
		return false;
	$('productMainImage').setStyle('top', ((155-height)/2)-4);	
	if ($('productMainImage').getStyle('opacity') == 0)
		new Fx.Style($('productMainImage'), 'opacity', {duration:700, transition:Fx.Transitions.expoInOut } ).start(0,1);
		
	return true;
}

function checkSelection()
{
	var ddlSize  = $('ddlSize');
	var iID		 = ddlSize.selectedIndex;
	var iCounted = 0;
	for(var i = 0; i < ddlSize.childNodes.length; i++)
	{
		if(ddlSize.childNodes[i].nodeName.toString().toLowerCase() == "option")
		{
			if(iID == iCounted)
			{
				iID = ddlSize.childNodes[i].value;
				break;
			}

			iCounted ++;				
		}
	}
	
	var strLink = $('addToCart').href;
	
	var strIDPos	  = strLink.indexOf('&id=');
	var strLinkStart  = strLink.substr(0, strIDPos);
	
	$('addToCart').href = strLinkStart + '&id=' + iID + '&pid=' + iID;
}