﻿// JScript File of specialised CSR functions

function OnSelectState()
	{
	var TheState;
	TheState = document.FormDefault.FormFindState.value;
	if (TheState == "WA")
		window.open("http://www.monierprime.com.au");
	else if (TheState == "NZ")
		window.open("http://www.monier.co.nz");
	else
		{
		document.FormDefault.FormAction.value = "SelectState";
		document.FormDefault.submit();
		}
	}

function OnSelectStateLocal()
	{
	document.FormDefault.FormAction.value = "SelectStateLocal";
	document.FormDefault.submit();
	}

function OnSearch()
	{
	document.FormDefault.action = document.FormDefault.FormRelativeRoot.value + "Search/Default.aspx";
	document.FormDefault.FormAction.value = "Search";
	document.FormDefault.submit();
	}

function OnSubmit(TheAction)
	{
	document.FormDefault.FormAction.value = TheAction;
	document.FormDefault.submit();
	}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
	{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
	}

// Routine to popup the Request a Quote
var TheWindowRequestQuote = null;
function DoRequestQuote(TheSourcePage, TheState, ThePath)
	{
	var TheWindowWidth = 450;
	var TheWindowHeight = 500;
	var TheWindowTop = 0;
	var TheWindowLeft = 0;
	var TheWindowParams;
	if (screen.width)
		{
		TheWindowLeft = (screen.width - TheWindowWidth) /2;
		TheWindowTop = (screen.height - TheWindowHeight) /2;
		}
	TheWindowParams = "top=" + TheWindowTop + ",left=" + TheWindowLeft + ",width=" + TheWindowWidth + ",height=" + TheWindowHeight + ",scrollbars=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
	ThePath += "RequestQuote/Default.aspx?ParentPage=" + TheSourcePage + "&State=" + TheState;
	TheWindowRequestQuote = window.open(ThePath, "WindowRequestQuote", TheWindowParams);
	}

// Routine to popup the Request a Quote
var TheWindowTechnicalAdvice = null;
function DoTechnicalAdvice(ThePath)
	{
	var TheWindowWidth = 450;
	var TheWindowHeight = 500;
	var TheWindowTop = 0;
	var TheWindowLeft = 0;
	var TheWindowParams;
	if (screen.width)
		{
		TheWindowLeft = (screen.width - TheWindowWidth) /2;
		TheWindowTop = (screen.height - TheWindowHeight) /2;
		}
	TheWindowParams = "top=" + TheWindowTop + ",left=" + TheWindowLeft + ",width=" + TheWindowWidth + ",height=" + TheWindowHeight + ",scrollbars=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
	ThePath += "TechnicalAdvice/Default.aspx";
	TheWindowTechnicalAdvice = window.open(ThePath, "WindowTechnicalAdvice", TheWindowParams);
	}

// Routine to set the roll over for the thumbnail
var TheThumbnailOver = false;
function ThumbnailRollover(TheTarget, TheImage, TheParam)
	{
	TheThumbnailOver = true;
	MM_swapImage(TheTarget, TheImage, TheParam);
	}

// Routine to set the roll over for the thumbnail
function ThumbnailRollout()
	{
	TheThumbnailOver = false;
	window.setTimeout("ThumbnailRestore()", 3000);
	}

// Routine to set the roll over for the thumbnail
function ThumbnailRestore()
	{
	if (!TheThumbnailOver)
		MM_swapImgRestore();
	}
