//Browserhandling (needed)
function cm_bwcheck(){
this.ver=navigator.appVersion
this.agent=navigator.userAgent.toLowerCase()
this.dom=document.getElementById?1:0
this.ns4=(!this.dom && document.layers)?1:0;
this.op=window.opera
this.moz=(this.agent.indexOf("gecko")>-1 || window.sidebar)
this.ie=this.agent.indexOf("msie")>-1 && !this.op
if(this.op)
{
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1)
	this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1)
	this.op7=this.dom&&!this.op5&&!this.op6
}
else if(this.moz) this.ns6 = 1
else if(this.ie)
{
	this.ie4 = !this.dom && document.all
	this.ie5 = (this.agent.indexOf("msie 5")>-1)
	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
	this.ie6 = this.dom && !this.ie4 && !this.ie5 && ! this.ie55
}
this.mac=(this.agent.indexOf("mac")>-1)
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.op7)
this.usedom= this.ns6||this.op7
this.reuse = this.ie||this.op7||this.usedom
this.px=this.dom&&!this.op5?"px":""
return this
}

var bw=new cm_bwcheck()

//Message (needed)
function cm_message(txt){alert(txt); return false}

//Pagesize (needed)
function cm_page(frame){
if(!frame) frame = self
this.x=0; this.x2 =(!bw.ie)?frame.innerWidth:frame.document.body.offsetWidth-20;
this.y=0; this.orgy=this.y2= (!bw.ie)?frame.innerHeight:frame.document.body.offsetHeight-6;
this.x50=this.x2/2; this.y50=this.y2/2; return this
}

//Flashhandling (needed)
function lib_flashcheck(){
var browser = navigator.userAgent.toLowerCase();
flashVersion = 0;
// NS3+, Opera3+, IE5+ Mac
if ( navigator.plugins != null && navigator.plugins.length > 0 ) 
{
	var flashPlugin = navigator.plugins['Shockwave Flash'];
	if ( typeof flashPlugin == 'object' ) 
	{
		if ( flashPlugin.description.indexOf('7.') != -1 ) flashVersion = 7;
		else if ( flashPlugin.description.indexOf('6.') != -1 ) flashVersion = 6;
		else if ( flashPlugin.description.indexOf('5.') != -1 ) flashVersion = 5;
		else if ( flashPlugin.description.indexOf('4.') != -1 ) flashVersion = 4;
		else if ( flashPlugin.description.indexOf('3.') != -1 ) flashVersion = 3;
	}
} // IE4+ Win32 (VBscript)
else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
document.write('<scr' + 'ipt language="VBScript"\> \n');
document.write('on error resume next \n');
document.write('DIM obFlash \n');
document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
document.write('IF IsObject(obFlash) THEN \n');
document.write('flashVersion = 7 \n');
document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
document.write('flashVersion = 6 \n');
document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
document.write('flashVersion = 5 \n');
document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
document.write('flashVersion = 4 \n');
document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
document.write('flashVersion = 3 \n');
document.write('END IF');
document.write('</scr' + 'ipt\> \n');
} // no Flash
else {
flashVersion = -1;
}
return flashVersion;
}

var fv = lib_flashcheck()

//Cookiehandling (needed)
function lib_getcookieval (offset){
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

//Get Cookie (needed)
function lib_getcookie (name){
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
	var j = i + alen;
	if (document.cookie.substring(i, j) == arg)
	return lib_getcookieval (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0)
	break;
}
return null;
}

//Set Cookie (needed)
function lib_setcookie (name, value){
var argv = lib_setcookie.arguments;
var argc = lib_setcookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
// Set expiration date to a year from now.
var expdate = new Date();
expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 365));

//Create a Pop-Up (Improved version for NS4.7)
function open_function(url,width,height,options){
var open_function_page = new cm_page();
var sreferrer_url = url;
var sreferrer_cookie = lib_getcookie('sReferrer');
var separator = '';

// replace by cookie or default value if sreferrer={$} is found in url
// flag in Redirect template controls whether this is written to url 
if(url.indexOf("sreferrer")>-1)
{
	if (sreferrer_cookie == '' || sreferrer_cookie == null){
		if(document.location.href.indexOf("jaguar")>-1 || document.location.href.indexOf("nib00104")>-1)
			sreferrer_cookie = 'I_JAGUARGSR_REDIRECT_2004';
		else
			sreferrer_cookie = 'I_LANDROVERGWS_REDIRECT_2004';
	}
	
	sreferrer_url = sreferrer_url.replace(/sreferrer%3D/gi,"sReferrer=");
	sreferrer_url = sreferrer_url.replace(/sreferrer=/gi,"sReferrer=");
	sreferrer_url = sreferrer_url.replace(/%7B%24%7D/gi,sreferrer_cookie);
	sreferrer_url = sreferrer_url.replace(/\{\$\}/gi,sreferrer_cookie);
}

if(options.substring(0,1) != ',') separator = ',';
self.msgWindow = open(sreferrer_url,"blank","width=" + width + ",height=" + height
+ ",dependent=yes"
+ ",left=" + (open_function_page.x2-width)/2
+ ",top=" + (open_function_page.y2-height)/2
+ separator + options
);
self.msgWindow.focus();
if (self.msgWindow.opener == null) self.msgWindow.opener = self;
}

//Change to a new Window
function open_site(x){
	var sreferrer_cookie = lib_getcookie('sReferrer');
	if(x == ""){
		return;
	}else{
		// replace by cookie or default value if sreferrer={$} is found in url
		// flag in Redirect template controls whether this is written to url 
		if(x.indexOf("sreferrer")>-1)
		{
			if (sreferrer_cookie == '' || sreferrer_cookie == null){
				if(document.location.href.indexOf("jaguar")>-1 || document.location.href.indexOf("nib00104")>-1)
					sreferrer_cookie = 'I_JAGUARGSR_REDIRECT_2004';
				else
					sreferrer_cookie = 'I_LANDROVERGWS_REDIRECT_2004';
			}
			
			x = x.replace(/sreferrer%3D/gi,"sReferrer=");
			x = x.replace(/sreferrer=/gi,"sReferrer=");
			x = x.replace(/%7B%24%7D/gi,sreferrer_cookie);
			x = x.replace(/\{\$\}/gi,sreferrer_cookie);
		}
		window.location.href = x;
	}
}


function getexactpath() {
	path = location.href;
	loc = location.href.split("/");

	exactpath = path.replace(loc[loc.length-1], "");
	return exactpath;
}


var popEnlarge
function OpenEnlargeImagePopup(popupurl,imagesrc,windowwidth,windowheight,imagealt)
{
	// split image URL into main part without dimension appendix and extension

	
	var imageURLmain
	if(imagesrc.lastIndexOf("_") == imagesrc.indexOf("_"))
	{imageURLmain = imagesrc.substring(0,imagesrc.length-4);}
	else
	{imageURLmain = imagesrc.substring(0,imagesrc.lastIndexOf("_"));}
	var imageURLext  = imagesrc.substring(imagesrc.length-4,imagesrc.length);
	
	// always set width to 670 for LR and 669 for JAG, SB, 26.10.2004, CR 189
	var popWidth = 0;
	var popHeight= 0;
	if(document.location.href.indexOf("jaguar")>-1 || document.location.href.indexOf("nib00104")>-1)
		{popWidth = 669;}
	else
		{popWidth = 670;}

	// parameters are empty for CMS Authoring
	if(windowwidth  == "") windowwidth = 670;
	if(windowheight == "") windowheight = 502;

	// add 0.01 to windowwidth as X40 ASP rounding slightly differs from Javascript rounding
	popHeight=Math.round((popWidth*windowheight)/(parseFloat(windowwidth)+0.01));

	if(windowwidth > popWidth || windowheight > popHeight){
		windowwidth  = popWidth;
		windowheight = popHeight;
	}	

	// manipulate image URL
//	imagesrc= imageURLmain + "_" + windowheight + "x" + windowwidth + imageURLext;
	imagesrc= imageURLmain + "_502x670" + imageURLext;

	if(popEnlarge!=null && !popEnlarge.closed){ 
	popEnlarge.close(); 
	}
	var source;
	var alttext;
	source = imagesrc.replace(/\//gi,"/");
	source = source.replace(/\./gi,".");
	alttext = imagealt.replace(/\./gi,".");
	alttext = encodeURIComponent(alttext);
	var URL = popupurl + "?src=" + source;
	URL = URL + "&width=" + windowwidth;		
	URL = URL + "&height=" + windowheight;
	URL = URL + "&alt=" + alttext;				
  var windowName = "EnlargedImage";
	
	if(document.location.href.indexOf("jaguar")>-1 || document.location.href.indexOf("nib00104")>-1)
		{if(windowheight != "0") windowheight = parseInt(windowheight) + 124;}
	else
		{if(windowheight != "0") windowheight = parseInt(windowheight) + 80;}
  var features = "top=10,left=10,width=" + windowwidth + ",height=" + windowheight + ",menubar=no,location=no,resizable=no,scrollbars=no,toolbar=no,status=yes";

  popEnlarge = window.open ("Land Rover " + URL, windowName, features);
  popEnlarge.focus();
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  alert('Query Variable ' + variable + ' not found');
}


var popWallpaper
function OpenDownloadWallpaperPopup(popupurl,imagesrc,width,height,screensize,path)
{
/////////// MODDDDDDDD
	if(popWallpaper!=null && !popWallpaper.closed){ 
	popWallpaper.close(); 
	}

	var source
	source = imagesrc.replace(/\//gi,"%2F");
	source = source.replace(/\./gi,"@");
	var URL = popupurl + "?src=" + source + "&width=" + width + "&height=" + height + "&screensize=" + screensize + "&path=" + path;
  var windowName = "DownloadWallpaper";
  var features = "width=" + width + ",height=" + height + ",menubar=no,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=yes";

  popWallpaper = window.open (URL, windowName, features);
  popWallpaper.focus();
}

function openwindow(windowurl, windowid, windowparm) {
	self.msgWindow = window.open(windowurl, windowid, windowparm);
	self.msgWindow.focus();
	if (self.msgWindow.opener == null) self.msgWindow.opener = self;
}



/*****************************************************************************************************************************/



function showgencode(){
ven = window.open('','_blank');

var results =document.documentElement.innerHTML;
var match = "<";
var re = new RegExp("<", "g");
var newresults = results.replace(re, "&lt;");

ven.document.write(newresults); 
} 



function launchPrint(){
	printpage = window.open('#', 'printpage', 'width=780,height=500,scrollbars=yes');
	var p = document.documentElement.innerHTML;
	var c = '	<div class="print_header">		<table height="50" width="100%" valign="middle" border="0">			<tr>				<td>					<span class="print_logo">						<img src="../../../global_30/img/brand_logo_80_wide.gif" border="0"/>					</span>				</td>				<td align="right">					<span id="printthispage">						<table border="0" cellpadding="0" cellspacing="0" class="printlinkblockspec" align="right"><tr><td class="linktextcs1"><a class="default" onmouseover="swaplink(\'printimageid\',printhover,\'printanchorid\',\'texthover\');" onmouseout="swaplink(\'printimageid\',printlink,\'printanchorid\',\'textlink\');" href="#" onclick="javascript:window.print()"><img id="printimageid" src="../../../global_30/img/print_icon.gif" border="0"></a></td><td class="printlinktext"><a class="default" onmouseover="swaplink(\'printimageid\',printhover,\'printanchorid\',\'texthover\');" onmouseout="swaplink(\'printimageid\',printlink,\'printanchorid\',\'textlink\');" href="#" onclick=\"javascript:window.print()\" id=\"printanchorid\">Print this page</a></td></tr></table>					</span>				</td>			</tr>		</table>	</div>';

//	printpage.document.write(c + p + '<scr'+'ipt language="JavaScript">\r\n<!--\r\n	printstrip();  \r\n-->\r\n</scr'+'ipt>');
	printpage.document.write(c + p + '<scr' + 'ipt>\r\nfunction getFile(filename){	oxmlhttp = null;	try {		oxmlhttp = new XMLHttpRequest();		oxmlhttp.overrideMimeType("text/xml");	}	catch(e){		 try { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }		 catch(e){ return null; }	}	if(!oxmlhttp) return null;	try {		oxmlhttp.open("GET",filename,false);		oxmlhttp.send(null);	}	catch(e){ return null; }	return oxmlhttp.responseText;}\r\n\r\nfunction printstrip(){	var CSSAdd;	var cssFILE = \'../../../BrandsCommon/script/print.css\';	if (getFile(cssFILE)==null){		cssFILE = \'../../../../BrandsCommon/script/print.css\';		if (getFile(cssFILE)==null){			cssFILE = \'../../../../../BrandsCommon/script/print.css\';			if (getFile(cssFILE)==null){				alert(\'no print.css\');				return;			}		}	}	head=document.getElementsByTagName(\'HEAD\')[0];		CSSAdd=document.createElement(\'LINK\');	CSSAdd.rel=\'stylesheet\';	CSSAdd.type=\'text/css\';	CSSAdd.href=cssFILE;	head.appendChild(CSSAdd);}\r\n	printstrip();</scr' + 'ipt>\r\n');
}

function getFile(filename){
	oxmlhttp = null;
	try {
		oxmlhttp = new XMLHttpRequest();
		oxmlhttp.overrideMimeType("text/xml");
	}
	catch(e){
		 try { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
		 catch(e){ return null; }
	}
	if(!oxmlhttp) return null;
	try {
		oxmlhttp.open("GET",filename,false);
		oxmlhttp.send(null);
	}
	catch(e){ return null; }
	return oxmlhttp.responseText;
}
function printstrip(){
	var CSSAdd;
	var cssFILE = '../../../BrandsCommon/script/print.css';
	if (getFile(cssFILE)==null){
		cssFILE = '../../../../BrandsCommon/script/print.css';
		if (getFile(cssFILE)==null){
			cssFILE = '../../../../../BrandsCommon/script/print.css';
			if (getFile(cssFILE)==null){
				alert('no print.css');
				return;
			}
		}
	}
	head=document.getElementsByTagName('HEAD')[0];
	// next line removes the previously added StyleSheet
/*	if (CSSAdd){ head.removeChild(CSSAdd); }*/
	CSSAdd=document.createElement('LINK');
	CSSAdd.rel='stylesheet';
	CSSAdd.type='text/css';
	CSSAdd.href=cssFILE;
	head.appendChild(CSSAdd);
	alert('printstrip');
}


function genhead(text, pathprefix){
	var swf = pathprefix + "BrandsCommon/script/tag.swf";
	document.write('<div class="graphictitle"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="599" height="30" id="tag" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + swf + '?tag=' + text + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="' + swf + '?tag=' + text + '" quality="high" bgcolor="#ffffff" width="599" height="30" name="tag" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>\n</div>');
}



function enlargee(imgsrc) {
//	document.write('<html>\r\n	\r\n<title>Land Rover Romnia - Popup imagine</title>\r\n	\r\n<meta name="Generator" content="JLR-Content-Reader-Engine"/>\r\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>\r\n<meta http-equiv="Content-Language" content="EN"/>\r\n<meta name="description" content=""/>\r\n<meta name="keywords" content=""/>\r\n<meta name="MS.LOCALE" content="en"/>\r\n<meta name="Codepage" content="65001"/>\r\n<meta name="ROBOTS" content="index,follow"/>\r\n<link rel="stylesheet" type="text/css" href="/global_30/css/lrweb_common.css"/>\r\n<script type="text/javascript" src="/BrandsCommon/script/jlrweb_common.js"></script>\r\n	<head>\r\n		<title>Land Rover - </title>\r\n		<link rel="stylesheet" type="text/css" href="/global_30/css/LRWeb_Popups.css"/>\r\n	</head>\r\n\r\n	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">\r\n	<table border="0" cellspacing="0" cellpadding="0" height="80" width="" class="enlarge_popup_bg">	<tr class="enlarge_popup_bg">		<td align="left" width="78" height="40"><img src="../../../../global_30/img/Brand_logo_small.gif" width="78" height="40" /></td>		<td align="left" class="enlarge_popup_title"></td>		<td align="right"><a href="javascript:window.close();" class="white">Close Window</a></td>	</tr>\r\n	<tr class="enlarge_popup_bg">		<td width="78"><img src="../../../../global_30/img/1px.gif" width="78" height="1" /></td>		<td colspan="2" align="left" width="-78"><img src="../../../../global_30/img/1px.gif" width="-78" height="1" /></td>	</tr>\r\n	<tr valign="middle">\r\n		<td colspan="3" height="" class="enlarge_popup_image">\r\n\r\n\r\n');
//	document.write('	<table border="0" cellspacing="0" cellpadding="0" height="80" width="" class="enlarge_popup_bg">	<tr class="enlarge_popup_bg">		<td align="left" width="78" height="40"><img src="/global_30/img/Brand_logo_small.gif" width="78" height="40" /></td>		<td align="left" class="enlarge_popup_title"></td>		<td align="right"><a href="javascript:window.close();" class="white">Close Window</a></td>	</tr>\r\n	<tr class="enlarge_popup_bg">		<td width="78"><img src="/global_30/img/1px.gif" width="78" height="1" /></td>		<td colspan="2" align="left" width="-78"><img src="/global_30/img/1px.gif" width="-78" height="1" /></td>	</tr>\r\n	<tr valign="middle">\r\n		<td colspan="3" height="" class="enlarge_popup_image">\r\n\r\n');


	document.write('<td><img src="Gallery/' + imgsrc + '" border="0" /></td>');
//	document.write('</tr>\r\n	<tr>\r\n		<td colspan="3" height="40"><img src="/global_30/img/1px.gif" width="" height="40" /></td>\r\n	</tr>\r\n</table>\r\n<div style="display:none"><IMG SRC="/global_30/img/1px.gif" WIDTH="0" HEIGHT="0" BORDER="0"></div><div style="display:none"><IMG SRC="/global_30/img/1px.gif" WIDTH="0" HEIGHT="0" BORDER="0"></div></body>\r\n</html>\r\n');
}

/*****************************************************************************************************************************/

/*<a href="javascript:OpenEnlargeImagePopup('../../../../_misc/EnlargeImagePopup.htm',getexactpath()+'Range_Rover_overview_6CA213E6-1A09-4D5A-A04B-D37A38B95EFB_108x144.jpg','1280','960','The Range Rover');" class="default" onMouseOver="swaplink2('InfoBlockEnlarge_3', MagnifyImageSelected)" onMouseOut="swaplink2('InfoBlockEnlarge_3', MagnifyImageUnselected)"><img id="InfoBlockEnlarge_3" src="../../../../global_30/img/magnify_icon.gif"  width="15" height="9" border="0" />Mareste imaginea</a>*/