<!--
function openWin( windowURL, windowName, windowFeatures ) {
	// default to this dimension if no dimension specified
	if ( windowFeatures == "" ) {
		windowFeatures = "width=565,height=360,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,left=120, top=80"
	}
	return window.open( windowURL, windowName, windowFeatures ) ; 
} 
// -->

<!--
function refreshPage() {
  // Refreshes the page
	window.location.href = window.location.href;
} 
// -->

<!--
function sendToOpener() {
  // Refreshes the page
	document.form_refresh.action=window.opener.location;
	document.form_refresh.target=windowOpener;
	document.form_refresh.submit();
	//alert('in sendToOpener');

} 
// -->

<!--
function reloadOpener() {
  // Refreshes the opener page
	window.opener.name = "mainwindow"
	var windowOpener = window.opener.name;
	//document.product.action=window.opener.location;
	//document.product.target=windowOpener;
	document.product.submit();
	document.form_refresh.action=window.opener.location;
	document.form_refresh.target=windowOpener;

    window.opener.location.reload();
    window.opener.location.href = window.opener.location.href; 
	
	setTimeout("document.form_refresh.submit()", 1000);
	document.form_refresh.submit();
	//alert('in reloadOpener');
	//document.form_refresh.submit();
	//setTimeout("window.opener.location.reload(true)", 2000)
	//setTimeout("window.opener.focus()", 1000)
	//setTimeout("window.close()", 4000)
} 
// -->

<!--
function reloadService() {
  // Refreshes the opener page
	window.opener.name = "mainwindow"
	var windowOpener = window.opener.name;
	//document.product.action=window.opener.location;
	//document.product.target=windowOpener;
    document.product.quantity.value =  document.product.qty.value;
    document.product.oc_id.value =  document.product.oc_id_temp.value;
	document.product.submit();
	document.form_refresh.action=window.opener.location;
	document.form_refresh.target=windowOpener;
   
	setTimeout("document.form_refresh.submit()", 1000);
	//alert('in reloadService');

	//setTimeout("window.opener.location.reload(true)", 2000)
	//setTimeout("window.opener.focus()", 1000)
	//setTimeout("window.close()", 2200)
} 
// -->

<!-- start hiding script
// no popup window <select onChange="jumpHere( this, false )">
// with popup window <select onChange="jumpHere( this, true )">
function jumpHere (which, win)
{
	n = which.selectedIndex;
	var URL = which.options[which.selectedIndex].value;
	if (win){
		openWindow(URL);
	}
	else{
		window.location.href = URL;
	}
}
// end hiding script --->

/*
function popup(Do)
{
	
	if(Do == 1)
	{
	
		var popurls=new Array();
		popurls[0]="http://www.sydneyroosters.com.au/popup.php";
		loadornot(popurls);
	}
	
}
function openpopup(popurl)
{
	var winpops=window.open(popurl,"","width=330,height=330")
}
*/

function get_cookie(Name) 
{
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) 
  {
    offset = document.cookie.indexOf(search)
    if (offset != -1) 
	{// if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
		end = document.cookie.length;
		returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(popurls)
{
	if (get_cookie('jkpopup')=='')
	{
		openpopup(popurls[Math.floor(Math.random()*(popurls.length))])
		document.cookie="jkpopup=yes"
	}
}

<!-- set to 0 or 1 depending on whether you want it to display -->
//popup(1);

// Disable Season drop-down list if Search Type is 'Stock Service Only'
function disableSeason(search_type)
{
  var x=document.getElementById("Season");
 
  if (x == null)
    return;
  
  var rad_val = search_type;  
  
  if (rad_val == "service")
  {
    x.disabled = true;
  }
  else
  {
    x.disabled = false;
  }
}

function getBrands(searchtype)
{
	location.href = 'search_custom.php?search_type=' + searchtype.value; 
}
