function showFullPicture ( pageUrl, pageHeight, pageWidth ) 
{		
	myWin= open("", "displayWindow", "width="+pageHeight+",height="+pageWidth+",status=no,toolbar=no,menubar=no,resizable=no,left=50,top=50");  
	myWin.document.open();  
	myWin.document.write("<html><head><title>.</title>");
	myWin.document.write("</head><body bgcolor=black topmargin=0 leftmargin=0>");
	myWin.document.write("<a href='javascript:close()'><center><img src="+pageUrl+" border=0></center></a>");  	  
	myWin.document.write("</body></html>"); 
	myWin.document.close();  
}

function showPopup ( popupWindow, popupTitle, popupContent, pageHeight, pageWidth, distanceX, distanceY ) 
{		
	myWin= open("", popupWindow, "width="+pageHeight+",height="+pageWidth+",status=no,toolbar=no,menubar=no,resizable=no,left="+distanceX+",top="+distanceY);  
	myWin.document.open();  
	myWin.document.write("<html><head><title>" + popupTitle + "</title>");
	myWin.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style_popup.css\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>"); 
	//myWin.document.write(decodeURI(popupContent).replace(/%2F/gi, '/')); 
	//myWin.document.write(unescape(popupContent));
	myWin.document.write(decodeURI(popupContent).replace(/%2F/gi, '/').replace(/%3D/gi, '=').replace(/%23/gi, '#').replace(/%26/gi, '&').replace(/%3B/gi, ';').replace(/%3A/gi, ':').replace(/%3F/gi, '?'));
	myWin.document.write("</body></html>"); 
	myWin.document.close();  
}

function showbigpic ( page, name, widthpic, heightpic )
{
	myWin= open("", "displayWindow", "width="+widthpic+",height="+heightpic+",status=no,toolbar=no,menubar=no,resizable=no,left=20,top=20");
	myWin.document.open();
	myWin.document.write("<html><head><title>"+name+"</title>");
	myWin.document.write("</head><body bgcolor=black topmargin=0 leftmargin=0>");
	myWin.document.write("<a href='javascript:close()'><center><img src="+'inc/watermark/getimage.php?image_file='+page+" border=0></center></a>");
	myWin.document.write("</body></html>");
	myWin.document.close();
}

function redirect (url)
{	
	//ok = confirm ('Ar tikrai norite trinti?');
	//if (ok) 
	//{
		window.location.href = url;	
	//}	
}


function setPointer(theRow, thePointerColor)
{
	if ((thePointerColor == '' || typeof(theRow.style) == 'undefined')) {return false;}
	if (typeof(document.getElementsByTagName) != 'undefined') {var theCells = theRow.getElementsByTagName('td');}
	else if (typeof(theRow.cells) != 'undefined') {var theCells = theRow.cells;}
	else {return false;}
	if (theRow.style.backgroundColor != '') {return false;}
	var rowCellsCnt  = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {theCells[c].style.backgroundColor = thePointerColor;}
	return true;
}


function openWindow(url) {
window.open(url, "", "left=200,top=100,height=500,width=420,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
}

function switchContent(ID) {

	objectLayer=document.getElementById(ID);
	//objectLayer.innerHTML = sText;
	if(objectLayer.style.visibility == 'hidden'){
		objectLayer.style.visibility = 'visible';
		objectLayer.style.display = 'block';
		//objectLayer.innerHTML = sText;
		return true;
	}else{
		objectLayer.style.visibility = 'hidden';
		objectLayer.style.display = 'none';
		return false;
	}
}


//shop
function switchContent(ID) {

	objectLayer=document.getElementById(ID);
	//objectLayer.innerHTML = sText;
	if(objectLayer.style.visibility == 'hidden'){
		objectLayer.style.visibility = 'visible';
		objectLayer.style.display = 'block';
		//objectLayer.innerHTML = sText;
		return true;
	}else{
		objectLayer.style.visibility = 'hidden';
		objectLayer.style.display = 'none';
		return false;
	}
}

function productAmount(productID, change_amount) {
	var amount = parseInt(document.getElementById('product_amount'+productID).firstChild.data);
	amount += parseInt(change_amount);
	if(amount<1)amount=1;
	document.getElementById('product_amount'+productID).firstChild.data = amount;
	document.getElementById('product_quantity'+productID).value = amount;
	calculatePrice(productID);
	/*
	if(amount>0){
		document.getElementById('product_to_cart'+productID).style.visibility='visible';
	}else{
		document.getElementById('product_to_cart'+productID).style.visibility='hidden';
	}
	*/
}

function calculatePrice(productID) {
//document.getElementById(id).firstChild.data = amount
productID = parseInt(productID);
var i;
var amount = parseInt(document.getElementById('product_amount'+productID).firstChild.data);
//if(amount<=0){amount = 1; document.getElementById('product_amount'+productID).firstChild.data = amount;}
var priceOriginal = parseFloat(document.getElementById('product_price_original'+productID).value); 
//var priceOriginal = document.getElementById('product_price_original'+id).value; 
var price = amount*priceOriginal;





var price_extra;
var product_form_elements = eval('document.product_form'+productID+'.elements');

	for(i=0; i < product_form_elements.length; i++){
		if(product_form_elements[i].type == 'checkbox' && product_form_elements[i].checked){
			price_extra = parseFloat(product_form_elements[i].value);
			price += amount*price_extra;
		}
	}

//alert(price);
price = String(price.toFixed(2)).replace('.', ',');
document.getElementById('product_price'+productID).firstChild.data = price;
}


