var iconActive = false;
var OS = 1;
var prodId = 0;


function ImageViewerFlash(baseDomain, productId)
{
	document.write('<object id="flashImageViewer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="330" height="180" align="middle" VIEWASTEXT>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="/flash/imageviewer/fadeImages_ws.swf?domain=' + baseDomain + '&prod_ID=' + productId + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<param name="wmode" value="opaque" />');
	document.write('<embed name="flashImageViewer" src="/flash/imageviewer/fadeImages_ws.swf?domain=' + baseDomain + '&prod_ID=' + productId + '" swLiveConnect="true" quality="high" bgcolor="#ffffff" width="330" height="180" align="middle" wmode="opaque" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function SearchJavaStart(partnerId, width, height, parameterSet, sessionId )
{
	document.write('<applet code="com.geosition.client.MapApplet.class" codebase="http://api.geosition.com/' + partnerId + '/client/" archive="GeositionClient.jar" name="map" width="' + width + '" height="' + height + '" valign="top" align="middle" mayscript VIEWASTEXT>');
	document.write('<param name="partner" value="' + partnerId + '">');
	document.write('<param name="parameterSet" value="' + parameterSet + '">');
	document.write('<param name="session" value="' + sessionId + '">');
}

function SearchJavaEnd()
{
	document.write('</applet>');
}

function MapFlash(siteId, langId)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="182" height="430" id="camping4" align="middle" VIEWASTEXT>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="/flash/' + siteId + '/map_' + langId + '.swf?langId=' + langId + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="/flash/' + siteId + '/map_' + langId + '.swf?langId=' + langId + '" quality="high" width="182" height="430" name="camping4" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />');
	document.write('</object>');
	
//	document.write('<embed src="/flash/' + siteId + '/map.swf?langId=' + langId + '" quality="high" width="182" height="430" name="camping4" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
}


function TeaserHeader(text, color, width)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="23" id="Header" align="middle" VIEWASTEXT>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="/flash/text/header.swf?title_param=' + text + '&color_param=' + color +'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="/flash/text/header.swf?title_param=' + text +'&color_param=' + color + '" quality="high" bgcolor="#ffffff" width="' + width +'" height="23" name="FlashHeader" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function DatePicker(fromfield, tofield, fromdate, todate)
{
	window.open("/templates/pages/datepicker.aspx?FieldDateFrom=" + fromfield + "&FieldDateTo=" + tofield + "&DateFrom=" + fromdate + "&DateTo=" + todate, "", "width=440,height=190");
}

function SendLink(url, pageid)
{
	window.open("/templates/pages/sendlink.aspx?pageid=" + pageid + "&url=" + url, "WinSendLink", "width=340,height=300");
}

function prodImagePopup(prodId, imageId)
{
	window.open("/templates/pages/prodImagePopup.aspx?prodId=" + prodId + "&imageId=" + imageId, "winProdImages", "width=500, height=325, resizable=1");
}

function favPrint(langId)
{
	var w = window.open("/templates/pages/FavouritesPrint.aspx?langId=" + langId,"WinFavPrint","width=640,height=480,resizeable=1");
	w.focus();
}

function goToProduct(prodid)
{
	window.frames["frmMap"].frames["frmItemReturn"].history.go(-1);
	top.location = ProductPageURL + "?prodid=" + prodid;
}

function switchFacility()
{
	elTxtCon = document.getElementById("ProdFacilityText");
	elImgCon = document.getElementById("ProdFacilityImg");
	for(i=0; i < elImgCon.childNodes.length; i++)
	{
		if (elImgCon.childNodes[i].tagName == "IMG")
		{
			try
			{
				elImgCon.childNodes[i].src = "/images/facilities/" + elImgCon.childNodes[i].id + ".gif";
			}
			catch (e) {}
		}
	}
	if (!iconActive)
	{
		elImgCon.style.cssText = "display:block;";
		elTxtCon.style.cssText = "display:none;";
		document.getElementById("imgSwitchFacility").src = "/images/" + EPiLang + "/btnText.gif";
		iconActive = true;
	}
	else
	{
		elImgCon.style.cssText = "display:none;";
		elTxtCon.style.cssText = "display:block;";		
		document.getElementById("imgSwitchFacility").src = "/images/" + EPiLang + "/btnSymbols.gif";
		iconActive = false;
	}
}

function AddFavourite(prodid, alertmsg)
{
	expiredays = 90;
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+90);
	
	CookieValueExists = document.cookie.indexOf(prodid);
	
	if (CookieValueExists == -1)
	{
		if (getCookie('SCRFavourites') != "")
			{
				c_value = getCookie('SCRFavourites');
				document.cookie="SCRFavourites" + "=" + escape(prodid) + "," +  c_value + ";expires="+exdate.toGMTString();
			}
			else
			{
				document.cookie="SCRFavourites" + "=" + escape(prodid) + ";expires="+exdate.toGMTString();
		
			}
	}
	alert(alertmsg);
}

function removeFav(prodid)
{
	c_value	= getCookie('SCRFavourites');
	
	cTmpArray = c_value.split(",");
	var i = 0;
	
	for (i=0;i<cTmpArray.length;i++)
	{
		if (cTmpArray[i] == prodid)
		{
			cRemoveIndex = i;
		}
	}
	
	cTmpArray.splice(cRemoveIndex,1);
	
	expiredays = 90;
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+90);
	document.cookie="SCRFavourites" + "=" +  cTmpArray.join(",") + ";expires="+exdate.toGMTString();
	document.forms[0].submit();
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
				return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return "";
}


function HideContent(d) 
{
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) 
{
	document.getElementById(d).style.display = "block";
}

function ReverseDisplay(d) 
{
	if(document.getElementById(d).style.display == "none") 
	{ 
		document.getElementById(d).style.display = "block"; 
	}
	else 
	{
		document.getElementById(d).style.display = "none"; 
	}
}



