////////// BROWSER DETAILS //////////////
var browser = new Array();
browser["name"];
browser["version"];

var browserDims = new Array();



window.onload = function(){
	browserDimensions = getBrowserSize();
	userBrowser = detectBrowser();
	
	if(userBrowser.name == 'Apple Computer, Inc.'){
		//document.getElementById("searchInput").style.left = ((browserDimensions.width / 2) + 220) +"px";
		//document.getElementById("titleText").style.left = ((browserDimensions.width / 2)- 450) +"px";
		
		if(document.getElementById("googleFrame")){
			document.getElementById("googleFrame").style.width = "530px";
			document.getElementById("googleFrame").style.height = "440px";
		}
		if(document.getElementById("googleMapFrame")){
			document.getElementById("googleMapFrame").style.padding = "5px";
		}
		
		
		
	}else{
		//document.getElementById("searchInput").style.left = ((browserDimensions.width / 2) + 85) +"px";
		//document.getElementById("titleText").style.left = ((browserDimensions.width / 2) - 600) +"px";
	}

	if(userBrowser.name == 'Netscape'){

		//document.getElementById("searchInput").style.left = ((browserDimensions.width / 2) + 10) +"px";
		
		if(document.getElementById("googleFrame")){
			document.getElementById("googleFrame").style.width = "500px";
			document.getElementById("googleFrame").style.height = "420px";
		}
		if(document.getElementById("googleMapFrame")){
			document.getElementById("googleMapFrame").style.padding = "5px";
		}
	}
	
}

function detectBrowser(){
	browser["name"] = navigator.vendor;
	if(browser["name"] == undefined || browser["name"] == ''){
		browser["name"]  = navigator.appName;
	}
	browser["version"]=navigator.appVersion;
	var version=parseFloat(browser["version"]);
	//alert(browser);
	return browser;
}

function getBrowserSize() {

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  browserDims["height"] = myHeight;
  browserDims["width"] = myWidth;

  return browserDims;
}
/////////// END BROWSER DETAILS //////////////


//////////////FUNCTIONS FOR TOP LINKS/////////////
var activeLink ;
function changeBGOver(elem){

	for (i=1; i<=6; i++){
		if(i == elem){
			document.getElementById("topLink"+i).style.background = "url(images/layout/topMenuHLight.jpg)  repeat-x";
			document.getElementById("topLink"+i).childNodes[0].style.color = "#ffffff";
		}else{
			if(i != activeLink){
			document.getElementById("topLink"+i).style.background = "url(images/layout/topMenuLLight.gif)  repeat-x";
			document.getElementById("topLink"+i).childNodes[0].style.color = "#B0C1CF";
			}
		}
	}

}

function changeBGOut(elem){

	if(elem != activeLink){
		document.getElementById("topLink"+elem).style.background = "url(images/layout/topMenuLLight.gif)  repeat-x";
		document.getElementById("topLink"+elem).childNodes[0].style.color = "#B0C1CF";
	}
}

function setBGOver(elem){
	document.getElementById("topLink"+elem).style.background = "url(images/layout/topMenuHLight.jpg)  repeat-x";
	document.getElementById("topLink"+elem).childNodes[0].style.color = "#ffffff";
}


function changePage(i,page){
	activeLink = i;
	top.location.href= page;
}

//////////////END FUNCTIONS FOR TOP LINKS/////////////

function showDetails(id){

	if(document.getElementById('imgDetails'+id).src == "http://"+document.domain+"/findyourselfonhastings/images/layout/hideDetails.jpg"){
		document.getElementById('showDetails'+id).style.display = "none";
		document.getElementById('imgDetails'+id).src = "images/layout/showDetails.jpg";
	}else{
		document.getElementById('showDetails'+id).style.display = "block";
		document.getElementById('imgDetails'+id).src = "images/layout/hideDetails.jpg";
	}
}



function showVideo(vidPath,title){
	
	browserDimensions = getBrowserSize();
	//videoWin = null;
	
	//centre the window
	var openLeft = browserDimensions.width / 2 - 200;
	var openTop = browserDimensions.height / 2 + 300;
	
	
	videoWin = dhtmlmodal.open('productData', 'div', 'modalalertdiv', title, 'width=480px,height=300px,left='+openLeft+'px,top=100px,resize=0,scrolling=0',"recal");
	
	videoWin.style.zIndex=150;
 	
	videoWin.onclose=function(){
		
		if (vbrowser.name == "Apple Computer, Inc."){
			//this is to fix a bug in Safari where it wouldn't close the flash video player on close of the modal window
			videoWin.contentDoc.getElementById('showDetails').document.getElementById('flashcontent').innerHTML = '';
		}else{
		
		document.getElementById('contentFrame').src = "";
		}
		return true;
	}

	
	
	var vURL = "dsp_noosaVid.cfm?videoPath="+vidPath;

	vbrowser = detectBrowser();
		
		//Added this because of a bug in safari that can't handle obj.src being set
		if (vbrowser.name == "Apple Computer, Inc."){
			videoWin.load('iframe', vURL, '');
			videoWin.frames[0].style.border = "0px";
			videoWin.moveTo("middle", "middle");
			videoWin.setSize(800,640);
			
			
		}
		else {

			document.getElementById('contentFrame').src = vURL;
		}
		
	

}