function setCookie(NameOfCookie, value, expiredays){  
	var ExpireDate = new Date ();
    ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 *1000));
    document.cookie = NameOfCookie + "=" + escape(value) +((expiredays == null) ? "" : "; expires=" +  ExpireDate.toGMTString());
}

function getCookie(NameOfCookie){  
	if (document.cookie.length > 0){     
		begin = document.cookie.indexOf(NameOfCookie+"=");
		if (begin != -1){
		   begin += NameOfCookie.length+1; 
       		 end = document.cookie.indexOf(";", begin);
        	if (end == -1) end = document.cookie.length;
     		return unescape(document.cookie.substring(begin, end));       
    	 } 
    }
         return null; 
}


function create_poppage_simple(cartid, size, url) {
	if( size == "big" ){
		wstr = "width=800,";
     	hstr = "height=480,";
     }else{
     	wstr = "width=600,";
     	hstr = "height=400,";
     }
     
	bigurl=url;	

  window.popupWindow = open(
    bigurl,
    "popup_window",
    hstr
    + wstr
    +"screenX=50,"
    +"screenY=50,"
    +"resizable=yes,"
    +"scrollbars=yes,"
    +"status=no,"
    +"toolbar=no,"
    +"directories=no,"
    +"menubar=no" );
    popupWindow.focus();
} // end help

function create_poppage(cartid, size, url, preview) {

	if( size == "big" ){
		wstr = "width=800,";
     	hstr = "height=480,";
     }else{
     	wstr = "width=800,";
     	hstr = "height=400,";
     }
     
	bigurl=url + "?id=" + cartid;	
	// special case for showcart because this is a preview not a live page
	if( preview >= "1"){
			bigurl=url + "?id=" + cartid + "&onpage=1"+"&preview="+preview;
	}
	
	//bigurl="./show_cart.cgi?id=" + cartid;
  window.popupWindow = open(
    bigurl,
    "popup_window",
    hstr
    + wstr
    +"screenX=50,"
    +"screenY=50,"
    +"resizable=yes,"
    +"scrollbars=yes,"
    +"status=no,"
    +"toolbar=no,"
    +"directories=no,"
    +"menubar=no" );
    popupWindow.focus();
} // end help

function create_deleterowpoppage(cartid, size, url, preview, row) {

	if( size == "big" ){
		wstr = "width=800,";
     	hstr = "height=480,";
     }else{
     	wstr = "width=800,";
     	hstr = "height=400,";
     }
      
	bigurl=url + "?id=" + cartid + "&row=" +row +"&take_action=delete_photo";	
	// special case for showcart because this is a preview not a live page
	if( preview == "1"){
			bigurl=url + "?id=" + cartid + "&preview=1";
	}

	
	//bigurl="./show_cart.cgi?id=" + cartid;
  window.popupWindow = open(
    bigurl,
    "popup_window",
    hstr
    + wstr
    +"screenX=50,"
    +"screenY=50,"
    +"resizable=yes,"
    +"scrollbars=yes,"
    +"status=no,"
    +"toolbar=no,"
    +"directories=no,"
    +"menubar=no" );
    popupWindow.focus();
} // end help

function create_deletecartpoppage(cartid, size, url) {

	if( size == "big" ){
		wstr = "width=800,";
     	hstr = "height=480,";
     }else{
     	wstr = "width=800,";
     	hstr = "height=400,";
     }
      
	bigurl=url + "?id=" + cartid +"&take_action=delete_cart";	

  window.popupWindow = open(
    bigurl,
    "popup_window",
    hstr
    + wstr
    +"screenX=50,"
    +"screenY=50,"
    +"resizable=yes,"
    +"scrollbars=yes,"
    +"status=no,"
    +"toolbar=no,"
    +"directories=no,"
    +"menubar=no" );
    popupWindow.focus();
} // end help
