
function background_image_change(element,url){
	if(element.style){
		element.style.backgroundImage = 'url(' + url + ')'
	}
}

function nav_onmouseover(element,imageUrl){
	if(element.style){
		element.style.cursor='hand';
		//element.style.backgroundImage = 'url(' + imageUrl + ')';
	}
}

function nav_onmouseout(element,imageUrl){
	if(element.style){
		element.style.cursor='arrow';
		//element.style.backgroundImage = 'url(' + imageUrl + ')';
	}
}

function showContent(){

	if (document.layers) {
	   document['content'].visibility = 'show';
	  }
	  else if (document.all) {
	    document.all['content'].style.visibility = 'visible';
	  }
	  else if (document.getElementById) {
	    document.getElementById('content').style.visibility = 'visible';
	  }
}



function openWindow(url,style){

	window.open(url,'',style);
}

function openPanWindow(url){
	openWindow(url,'width=320,height=260,top=100,left=100');
}

function openLargeWindow(url){
	openWindow(url,'width=800,height=600,top=100,left=100,resizable=1,scrollbars=1,titlebar=1');
}

//	NAME: createFlashHTML()
//	DESCRIPTION:
//
//	used for displaying any flash movies in the main image div on the golf/beach/location screens
function createFlashHTML(url,height,width){

	var fHTML='<OBJECT codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" height=\"' + height + '\" width=\"' + width + '\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" VIEWASTEXT>'
    fHTML+='<PARAM NAME=\"_cx\" VALUE=\"15081\"> '
    fHTML+='<PARAM NAME=\"_cy\" VALUE=\"7091\"> '
    fHTML+='<PARAM NAME=\"FlashVars\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"Movie\" VALUE=\"' + url + '\"> '
    fHTML+='<PARAM NAME=\"Src\" VALUE=\"' + url + '\"> '
    fHTML+='<PARAM NAME=\"WMode\" VALUE=\"Window\"> '
    fHTML+='<PARAM NAME=\"Play\" VALUE=\"-1\"> '
    fHTML+='<PARAM NAME=\"Loop\" VALUE=\"-1\"> '
    fHTML+='<PARAM NAME=\"Quality\" VALUE=\"High\"> '
    fHTML+='<PARAM NAME=\"SAlign\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"Menu\" VALUE=\"-1\"> '
    fHTML+='<PARAM NAME=\"Base\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"AllowScriptAccess\" VALUE=\"always\"> '
    fHTML+='<PARAM NAME=\"Scale\" VALUE=\"ShowAll\"> '
    fHTML+='<PARAM NAME=\"DeviceFont\" VALUE=\"0\"> '
    fHTML+='<PARAM NAME=\"EmbedMovie\" VALUE=\"0\"> '
    fHTML+='<PARAM NAME=\"BGColor\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"SWRemote\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"MovieData\" VALUE=\"\"> '
    fHTML+='<PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\"> '
    fHTML+='<embed '
    fHTML+='src=\"' + url + '\" '
    fHTML+='quality=\"high\" '
    fHTML+='pluginspage=\"http://www.macromedia.com/go/getflashplayer\" '
    fHTML+='type=\"application/x-shockwave-flash\" '
    fHTML+='width=\"' + width + '\" '
	fHTML+='height=\"' + height + '\"> '
    fHTML+='</embed> '
	fHTML+='</OBJECT>'
		
		return fHTML;
	}
	
function drawFlashInMainDiv(url){

	var flashHTML=createFlashHTML(url,240,320);
	

	document.getElementById('mainImageDiv').innerHTML=flashHTML;

}


//cross-browser effort to switch backgrounds on or off with checkboxes
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function swapbg(id){
	if(document.forms[0].elements[id].checked == true) { 
		if(ns4){ document.layers[id].backgroundImage='url(/iberian/images/highlight-row.gif)'; }
		else if(ie4){ document.all[id].style.backgroundImage='url(/iberian/images/highlight-row.gif)'; }
		else if(ie5 || ns6){ document.getElementById(id).style.backgroundImage='url(/iberian/images/highlight-row.gif)'; }
	}
	else {
		if(ns4){ document.layers[id].backgroundImage=''; }
		else if(ie4){ document.all[id].style.backgroundImage=''; }
		else if(ie5 || ns6){ document.getElementById(id).style.backgroundImage=''; }
	}
}



dom = (document.getElementById) ? 1 : 0; 
function activatefield(what){
	if (dom){
		what.style.backgroundColor='#EAF1FF';
		what.style.color='#000';
	} 
}
function deactivatefield(what){
	if (dom){
		what.style.backgroundColor='';
		what.style.color='';
	}
}	

//	NAME: drawImageInDiv()
//	DESCRIPTION:
//
//	used for swapping in the supplied image into the specified div
function drawImageInDiv(url,divId,width,height){
	if(url==''){
		return;	
	} else {
		var HTML='<img src=\"' + url + '\" height=\"' + height + '\" width=\"' + width + '\"/>';	
		document.getElementById(divId).innerHTML=HTML;
	}
}

//findPosX from www.quirksmode.org
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

//findPosY from www.quirksmode.org
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

/*
displays the semi-transparent iberianmask flash movie on top of supplied image

*/
function drawFlashMask(imgToCover,moviePath,width,height)
{

	if(!imgToCover){return;}

	var flashMaskDiv=document.createElement("div");
	
	//reposition flashMaskDiv on top of imgToCover
	flashMaskDiv.style.position="absolute";
	flashMaskDiv.style.top=new String (findPosY(imgToCover)) + 'px';
	flashMaskDiv.style.left=new String (findPosX(imgToCover) + 1) + 'px';
	
	var lang = window.location.href.split('/')[3].toLowerCase();
	
	var flash= new SWFObject(moviePath,"iberianmask",width,height,6,"#000000");
	flash.addParam("quality", "high");
	flash.addParam("wmode", "transparent");
	flash.addVariable("language", lang);
	flash.addVariable("config", "/iberian/promotions.xml");
	flash.write(flashMaskDiv);
	
	document.forms[0].appendChild(flashMaskDiv);	
	
}

function drawRightFlashMask(imgToCover)
{
	drawFlashMask(imgToCover,"/iberian/brochure-right.swf",189,360)	
}

function drawLargeFlashMask(imgToCover)
{
	drawFlashMask(imgToCover,"/iberian/brochure-large.swf",569,220)	
}

