﻿ var popUpWin = null; 

function ShowPhoto(p, c) {
  if ((popUpWin == null) || popUpWin.closed )
  {  	
 	 popUpWin =window.open('photoView.aspx?p=' +p + '&c=' + c,'magnify','left=50,top=50,width=490,height=426,scrollbars=no,resizable=yes,status=no');
  }
  else
  {
    popUpWin.location = 'photoView.aspx?p=' +p + '&c=' + c;
    popUpWin.focus();
  } 	
 }
 
 function Add2ShoppingCart(itmno,qtyId)
 {
    sel = document.getElementById(qtyId);
    var qty = sel.options[sel.selectedIndex].value;
    var url='cart.aspx?addItem='+itmno+'&Qty='+qty;
    window.location=url;
 }
 
 var oInterval="";
 function ChangePhoto(itmno,photoid)
 {
 	if(oInterval!="")
        CancelChangeItemPhoto();
	
	if(oInterval==""){
		oInterval=window.setInterval("DoChangeItemPhoto('"+itmno+"',"+photoid+")",500);
	}	
 }
 
  function CancelChangePhoto()
 {
 	if(oInterval!=""){
		window.clearInterval(oInterval);
		oInterval="";
	}
 }
 
 function DoChangeItemPhoto(itmno,photoid)
 {
    CancelChangePhoto();
    var re = new RegExp('[\\/&]');
    itmno=itmno.replace(re, "");
    imgItem = document.getElementById("img"+itmno);
    if (imgItem)
    {
       url="img/product/"+itmno+"-"+photoid+".jpg";
       imgItem.src=url;
    }
 }
 
 function QOFShowPhoto(tr,itmno)
 { 
   tr.style.backgroundColor= "#ffffcc";
   
   qofImg = document.getElementById("QOFImg");
   var re = new RegExp('[\\/&]');
   itmno=itmno.replace(re, "");
   qofImg.src = 'img/product/'+itmno+'-1.jpg';
   qofImg.style.display = "";
 }
 
 function QOFClosePhoto(tr)
 {
    tr.style.backgroundColor= "";
    qofPhoto = document.getElementById("QOFImg");
    qofPhoto.style.display = "none";
 }
 
 function ShowToOrderCallPhoto()
 { 
   qofImg = document.getElementById("img2OrderCall");
   qofImg.style.display = "";
 }
 
 function CloseToOrderCallPhoto()
 {
    qofPhoto = document.getElementById("img2OrderCall");
    qofPhoto.style.display = "none";
 }
 