function set_Config()
{
  addqty("SETSTATUS","1")
  frames['hiddeniframe'].location.href='http://www4.eaccounts.co.nz/oCart.asp?shop=SEGEDIN%7C1%7CSETCONFIG=SF CB FB ON'
}

function refresh_Statuses()
{
  frames['items_displayTXT'].location.href='http://www4.eaccounts.co.nz/oTotal.asp?shop=SEGEDIN%7C1%7CCARTSUMMARY=YES'
}

function autorefresh()
{
  setInterval ( "refresh_Statuses()", 10000 );
}

function addqty(sItem,iQty)
{
  sBaseURL="http://www4.eaccounts.co.nz";
  sShopCode="SEGEDIN";
  sTarget="hiddeniframe";
  sGoURL=(sBaseURL+"/oCart.asp?shop="+sShopCode+"%7C1%7CADDITEMDIRECT="+sItem+"%7C"+iQty);
  frames[sTarget].location.href=sGoURL;
  setTimeout("refresh_Statuses()",100);
}
function popwin(sParam,iSecure)
{
  sBaseURL="http://www4.eaccounts.co.nz";
  if (iSecure) sBaseURL="https://www4.eaccounts.co.nz";
  sShopCode="SEGEDIN";
  sTarget="basket";
  //sSettings="top=10,left=10,width=830,height=675,location=no,menubar=no,status=no,toolbar=yes,scrollbars=yes";
  sSettings="top=10,left=10,width=830,height=675";
  sGoURL=(sBaseURL+"/oCart.asp?shop="+sShopCode+"%7C1%7C"+sParam);
  /*
  if (iSecure=="TEST")
  {
      sGoURL=("mypopup.html");
  }
  */
  //window.open(sGoURL,sTarget,sSettings);
  
  
    var W = "70%";
    var H = "60%";
    $.fancybox({
        'width': W,
        'height': H,
        'autoScale': true,
        'transitionIn': 'fade',
        'transitionOut': 'fade',
        'type': 'iframe',
        'href': sGoURL
    });

  
  /*oPopwin=window.open("about:blank",sTarget,"width=1 height=1 top=10 left=10");
  closewin();
  if (is_netscape())
  {
    oPopwin=window.open(sGoURL,sTarget,sSettings);
  }
  else {
    setTimeout("oPopwin=window.open(sGoURL,sTarget,sSettings);",100);
  }
  if (window.focus) {oPopwin.focus()};
  return false;
  */
}
 
function closewin()
{
 if(false == oPopwin.closed)
 {
    oPopwin.close ();
 }
 else
 {
//    alert('Window already closed!');
 }
}
function is_netscape()
{
var browser=navigator.appName;
 
if (browser=="Netscape") return true;
if (browser!="Netscape") return false;
}

function validateform(frm){
	
	var Firstname = document.getElementById("FirstName");	
	var Lastname = document.getElementById("LastName");
	var Email = document.getElementById("Email");
	
	var op1 = document.getElementById("onereqJDM");
	var op2 = document.getElementById("onereqV8");
	var op3 = document.getElementById("onereqStkRep");
	var op4 = document.getElementById("onereqAll");
	
	var Agreement = document.getElementById("chkAgreement");
	
	//alert(op1.checked + " " + op2.checked + " " + op3.checked + " " + op4.checked);
	//alert(Agreement.checked);
	
	var Condition1 = (Firstname.value != '' && Lastname.value != '' && Email.value !='') ? true : false;
	var Condition2 = (op1.checked !='' || op2.checked !='' || op3.checked != '' || op4.checked !='') ? true : false;
	var Condition3 = (Agreement.checked != '') ? true : false ;
	
	if (Condition1 && Condition2 && Condition3) {
		//alert("Validation Passed");
		return true;
	}
	else {
		alert("Please complete all the compulsory fields");
		return false;
	}	
}

function searchKeyPress(e)
{
		// look for window.event in case event isn't passed in
		if (window.event) { e = window.event; }
		if (e.keyCode == 13)
		{
			popwin('key='+document.getElementById('key1').value,0)
			//document.getElementById('btnSearch').click();
		}
}
