function setupPage(){
	setupLinks;
	LoadConversionTable();
	Load();
	LoadsIFR();
}

function setupLinks() {
	if (!document.getElementsByTagName)
	{
		return;
	}
	/// get all anchors in document
	var anchors = document.getElementsByTagName("a");
	
	/// loop though all anchors
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		
		if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external")
		{
			/// set target to blank window
			anchor.target = "_blank";
		}
		/// removes focus from the link when clicked
		//anchor.setAttribute("onfocus", "this.blur();");
	}
}
function ConfirmDelete(name){
	return confirm("Are sure that you want to delete the " + name + "?");
}

function FlashZoom(link){
	var newWindow = window.open(link,"ZoomWindow","height=540,width=590,status=yes,toolbar=no,menubar=no,location=no");
	newWindow.focus();
}

var googleMap;

function Load(){
	if(isdefined(googleMap)){
		ShowMap();
		//alert('True');
	}
	else{
		//alert('False');
	}
}

function isdefined(variable)
{
	return typeof(variable) != "undefined";
}

function LoadConversionTable()
{
	var conversionTable = document.getElementById("ConversionTable");
	if(conversionTable != null){
		conversionTable.innerHTML = "<select onchange='ChangeConversionTable(this);' id='GasMark'><option>Gas Mark 1</option><option>Gas Mark 2</option><option>Gas Mark 3</option><option>Gas Mark 4</option><option>Gas Mark 5</option><option>Gas Mark 6</option><option>Gas Mark 7</option><option>Gas Mark 8</option><option>Gas Mark 9</option></select>"
		conversionTable.innerHTML += "<select onchange='ChangeConversionTable(this);' id='Celcius'><option>140&deg;C</option><option>150&deg;C</option><option>160&deg;C</option><option>180&deg;C</option><option>190&deg;C</option><option>200&deg;C</option><option>210&deg;C</option><option>220&deg;C</option><option>240&deg;C</option></select>"
		conversionTable.innerHTML += "<select onchange='ChangeConversionTable(this);' id='Fahrenheit'><option>284&deg;F</option><option>302&deg;F</option><option>320&deg;F</option><option>356&deg;F</option><option>374&deg;F</option><option>392&deg;F</option><option>410&deg;F</option><option>428&deg;F</option><option>464&deg;F</option></select>"
	}
}

function ChangeConversionTable(Column)
{
	var changeIndex;
	var GasMark = document.getElementById("GasMark");
	var Celcius = document.getElementById("Celcius");
	var Fahrenheit = document.getElementById("Fahrenheit");
	//alert(Column.id);
	switch(Column.id){
		case "GasMark":
			Celcius.selectedIndex = GasMark.selectedIndex;
			Fahrenheit.selectedIndex = GasMark.selectedIndex;
			break;
		case "Celcius":
			GasMark.selectedIndex = Celcius.selectedIndex;
			Fahrenheit.selectedIndex = Celcius.selectedIndex;
			break;
		case "Fahrenheit":
			GasMark.selectedIndex = Fahrenheit.selectedIndex;
			Celcius.selectedIndex = Fahrenheit.selectedIndex;
			break;
	}
}

function ShowCalendar(TextBoxId){
	var textBox = document.getElementById(TextBoxId);
	//alert(textBox.value);
	var newWindow = window.open("Popups/DateSelector.aspx?date=" + textBox.value + "&field=" + TextBoxId,"DateWindow","height=240,width=290,status=yes,toolbar=no,menubar=no,location=no");
	newWindow.focus();
	return false;
}

window.onload = setupPage;

