<!--

//opens a new popup window containing the page from parameter "url":
var newWin;
function WinOpen(url,title,w,h){
	w=parseInt(w);
	h=parseInt(h);
	if (!mac) if (new String(newWin)!="undefined" && newWin!=null) if (!newWin.closed) newWin.close();
	newWin=window.open(url,title,"width="+w+",height="+h+",top=0,left=0,location=no,directories=no,hotkeys=no,copyhistory=no,resizable=yes,menubar=no,status=no,toolbar=no,scrollbars=yes,z-lock=yes");
	//if (mac) win.resizeTo(w+25,h+50);
	newWin.focus();
}

//opens a new popup window containing the image from parameter:
var newWinImg;
function OpenImage(imgFile){
	if (new String(newWinImg)!="undefined" && newWinImg!=null) if (!newWinImg.closed) newWinImg.close();
	var newWinImg=window.open("","ProjectNewWindowImage","width=100,height=100,top=0,left=0,location=no,directories=no,hotkeys=no,copyhistory=no,resizable=no,menubar=no,status=no,toolbar=no,scrollbars=no,z-lock=yes");
	newWinImg.document.write('<html><head><title>Project :: New Window Image</title></head><body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#ffffff" onload="window.resizeTo(parseInt(document.images[\'img\'].width)+10,parseInt(document.images[\'img\'].height)+29)"><img src="' + imgFile + '" name="img" /></body></html>');
	newWinImg.document.close();
	newWinImg.focus();
}

//used for paging:
function GoToPageNo(page){
	document.frmPaging.page.value=page;
	document.frmPaging.submit();
}

//used for paging:
function GoToRecNo(start){
	document.frmMain.start.value=start;
	document.frmMain.submit();
}

/// redirect product to shopping cart
function addToCart(param)
{
    window.location='cart.php?act=add&id='+param;
}

/// remove product from cart
function removeFromCart(param)
{
    window.location='cart.php?act=remove&id='+param;
}

/// moodify product quanity
function modifyCart(param)
{
    var frm=document.frmCart;
    frm.action='cart.php?act=edit&id='+param;
    frm.submit();
}

/// empty cart
function emptyCart()
{
    window.location='cart.php?act=empty';
}

/// validate order form
function ValidateOrderForm(frm)
{
   var btn1=frm.radPlata;
   btn1=valButton(btn1);
   
   var btn2=frm.radFacturare;
   btn2=valButton(btn2);
   
   if (Trim(frm.selTransport.value)=="") {alert("Va rugam selectati Modalitatea de Transport."); frm.selTransport.focus(); return false;}
   else if (btn1==null) {alert("Va rugam Bifati Modalitatea de Plata."); return false;}
   else if (btn2==null) {alert("Va rugam Bifati Modalitatea Facturare."); return false;}
   else
   {
        frm.action="order.php?act=order";
        return true;
   }
}

/// validate radio button
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function showDiv(divid) {
        if (divid=='2') {
            document.getElementById('hidDiv1').style.display = 'block';
        }
        else {
            document.getElementById('hidDiv1').style.display = 'none';
        }
    }
//-->