<!-- Distributed by Hypergurl http://www.hypergurl.com -->
// Popup larger image
//function popup(image) {
function popup() {
        var desktop=window.open("", "POP",'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=800,height=600,resizable=no,left=0,top=0');
        desktop.document.writeln("<title>Large Image</title>");
	desktop.document.writeln("<body bgcolor='#FFFFFF' topmargin='0' marginheight='0' leftmargin='0' marginwidth='0'>");
        desktop.document.writeln("<img src='/imageviewer.php?imagetype=6&itemkeycode=" + document.getElementById("currentimage").value + "'>");
        desktop.document.writeln("</body>");
}

function changeto(highlightcolor){
 source=event.srcElement || e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="DIV")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
    source.style.backgroundColor=highlightcolor
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source)
source.style.backgroundColor=originalcolor
}

function ChangePicture(filename) {
  document.getElementById("currentimage").value = filename;
//  if (filename.indexOf("imageviewer", 0) > 0) {
//    document.getElementById("prodimg").src = filename;
//    document.getElementById("prodimg").onclick = new Function("popup('" + filename + "')");
//  }
//  else {
    document.getElementById("prodimg").src = "imageviewer.php?filename=" + filename;
//    document.getElementById("prodimg").onclick = new Function("popup('/imageviewer.php?filename=" + filename + "')");
//    document.getElementById("prodimg").onclick = new Function("popup()");
    document.getElementById("currentimage").value
//  }
//    /imageviewer.php?itemkeycode=

  //alert(document.getElementById("prodimg").onclick);
}


function entsub(event) {
  if (window.event && window.event.keyCode == 13) document.frmLogin.submit();
  if (event && event.which == 13) document.frmLogin.submit();
  return true;
}

function addtotrolley(subcode) {
  if (document.subproduct.subcode.value != '') {
        document.addproduct.subcode.value = document.subproduct.subcode.value;
  }
  document.addproduct.quantity.value = document.FrmQuantity.quantity.value;
  document.addproduct.submit();
}


//----------------------------------------------------------------

function unavailable_notifiy(subcode,itemkeycode,section,point,campaigncode,participantcode){
  
   if(confirm("You will be notified when stock is available.")){ 
       $("#unavailable_notify").hide(); 
       $.post("/ajax/processUnavailable_product.php" , {itemkeycode:itemkeycode,subcode:subcode,section:section,point:point,campaigncode:campaigncode,participantcode:participantcode},function(data){if(data){alert(data)}});
   }
}


function editreview(control, val) {
  // On focus, clear comment box
  if (val == 1) { 
    if (control.value == "I would like to review this product...") { 
      control.value = "";
    }
  }
  // On blur, put message back in box
  if (val == 0) { 
    if (control.value == "") { 
      control.value = "I would like to review this product...";  
    }
  }
}

// Validation before submitting a review
function submitreview() { 
  if (document.getElementById("usercomment").value == "I would like to review this product...") { 
    alert("Review is a required field");
  } else {
    document.frmUserComments.submit();
  } 
}

var flag = "free";

function showhide(box) {
	
	if (flag == "free") { 
    	  if (document.getElementById(box).style.display == "none") {
//	    flag = "busy";
//	    setTimeout("flag = 'free'", 1000);
//            new Effect.SlideDown(box);
             $("#"+box).show("slow");
          } else {
//	    flag = "busy";
          //  new Effect.SlideUp(document.getElementById(box));
	    $("#"+box).hide();

          }
	}

}

function hideshow(box1, box2) {
  if (flag == "free") {
        if (document.getElementById(box1).style.display == "none") {
	  flag = "busy";
          setTimeout("flag = 'free'", 1000);
	  if (document.getElementById(box2).style.display != "none") { 
	    new Effect.SlideUp(document.getElementById(box2));
	  }
          new Effect.SlideDown(box1);
        } else {
	  flag = "busy";
          setTimeout("flag = 'free'", 1000);
          new Effect.SlideUp(document.getElementById(box1));
        }
  }
}

function printit(){
  if (window.print) {
    window.print() ;
  } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
  }
}


