var gex={};

gex.loadjs=function(url){
	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; 
		ga.src = url; ga.async = false;
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
}
gex.loadcss=function(url){
	var l=document.createElement('link');
	l.setAttribute('rel','stylesheet');
	l.type='text/css';
	l.async=true;
	l.setAttribute('href',url);
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(l, s);
}

function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;
// expires=new Date()
// expires.setMonth(expires.getMonth());  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
function 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 getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}


gex.arrIframes=document.getElementsByTagName('iframe')




/*
gex.css="http://secure-hotel-tracker.com/gotoexplorotel/shadowbox-3.0.3/shadowbox.css";
gex.js="http://secure-hotel-tracker.com/gotoexplorotel/shadowbox-3.0.3/shadowbox.js";

gex.loadcss(gex.css);
gex.loadjs(gex.js);
*/

gex.host=location.host.replace(/^www\./i, "");
gex.phrase=gex.host + " is changing!";
gex.phrase=(window['gex_custom_phrase'] || gex.phrase);
gex.font="font-family:helvetica,arial,sans-serif;font-weight:bold;font-size:19pt;color:#5A5758";

gex.locations=[
'http://www.explorotel.com/france/ile_de_france/paris/listview/',
'http://www.explorotel.com/france/ile_de_france/paris/mapview/',
'http://www.explorotel.com/france/ile_de_france/paris/topview/',
'http://www.explorotel.com/france/ile_de_france/paris/photoview/'
]
gex.locations = window['gex_custom_urllist'] || gex.locations;

gex.ln=(navigator.language || navigator.browserLanguage || 'en').substr(0, 2);
if(gex.ln=='fr'){
	for(var i=0;i<gex.locations.length;i++){
		gex.locations[i]=gex.locations[i].replace(/www\./,'fr.');
	}
}

gex.random = Math.floor ( Math.random() * gex.locations.length ); 
gex.location=gex.locations[gex.random]
//onclick=\"location.href='"+gex.location+"'\"
gex.banner=  'redir.png';
gex.banner=  window['gex_custom_banner'] || gex.banner;


gex.html="<div  style=\"overflow:hidden;cursor:pointer;background:url(http://secure-hotel-tracker.com/gotoexplorotel/"+gex.banner+");width:832px;height:416px\">"+
"<div style=\"padding-left:93px;padding-top:60px;"+gex.font+"\">"+
""+gex.phrase+
"<a style=\"text-decoration:none;display:block;height:356px;width:832px;\" href=\""+gex.location+"\">&nbsp;</a>"+
"</div>"+
""+
"</div>"



gex.hideiframes=function(){
	
	var arr=gex.arrIframes;
	for(var i=0;i<arr.length;i++){
		
		var iframe=arr[i]
		if(iframe.style.display.toLowerCase()!='none'){
			
			iframe.setAttribute('gexhidden','1');
			iframe.style.visibility='hidden'
		}
	}
	return true;
}


gex.showiframes=function(){
	var arr=gex.arrIframes;
	for(var i=0;i<arr.length;i++){
		var iframe=arr[i]
		if(iframe.getAttribute('gexhidden')){
			
			iframe.style.visibility='visible'
		}
	}
	
	return true;
}



function AttachEvent(obj,evt,fnc,useCapture){
		if (!useCapture) useCapture=false;
		if (obj.addEventListener){
			obj.addEventListener(evt,fnc,useCapture);
			return true;
		} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
		else{
			MyAttachEvent(obj,evt,fnc);
			obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
		}
	} 

	//The following are for browsers like NS4 or IE5Mac which don't support either
	//attachEvent or addEventListener
	function MyAttachEvent(obj,evt,fnc){
		if (!obj.myEvents) obj.myEvents={};
		if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
		var evts = obj.myEvents[evt];
		evts[evts.length]=fnc;
	}
	function MyFireEvent(obj,evt){
		if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
		var evts = obj.myEvents[evt];
		for (var i=0,len=evts.length;i<len;i++) evts[i]();
	}




gex.onShadowReady=function(){
	
	if(GetCookie('gotoexploroteldisplayed')){
		return;
	}
	
	
	
	window.setTimeout('gex.onShadowReady2()',300);
	
}





gex.onShadowReady2=function(){
	
	
	var expires=new Date()
	expires.setMonth(expires.getMonth()+2);  
	
	SetCookie('gotoexploroteldisplayed',1,expires);
	
	Shadowbox.init({
		handleOversize: "drag",
		modal: false,
		onOpen:gex.hideiframes,
		onClose:gex.showiframes
	});
	
	
	window.setTimeout('gex.onShadowReady3()',100);
	
}


gex.onShadowReady3=function(){
	 Shadowbox.open({
        content:    gex.html,
        player:     "html",
        //title:      "Welcome",
        width:      832,
        height:     416
    });
	
}


AttachEvent(window,"load",gex.onShadowReady,false);