<!--

/****************************************************************************
**
** Copyright (C) 2005-2006 Intuisphere. All rights reserved.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
function IsIncreasePhotoAlbumView(current_url,lang_code,is_preview,unid,xml_file,bgColor)
{
getElementByKey('is-global-layer').style.display="none"
displayElement(getElementByKey('is-global-layer-full-view'),true)
var fo = new SWFObject('crbst_cariboost.swf', 'viewer', '100%', '100%', '8',bgColor);
fo.addVariable("crbst_language",lang_code);
fo.addVariable("crbst_mode", "full_view");
fo.addVariable("crbst_unid",unid);
fo.addVariable("crbst_current_page_url",current_url);
if (is_preview)
{
fo.addVariable("crbst_is_preview","1");
}
fo.addVariable("crbst_type_component", "photo_album");
fo.addVariable("xml_definition",xml_file);
fo.write('is-global-layer-full-view');
}

function IsDecreasePhotoAlbumView()
{
getElementByKey('is-global-layer').style.display="block"
displayElement(getElementByKey('is-global-layer-full-view'),false)
IS_writeLayer(getElementByKey('is-global-layer-full-view'),"")
}

function checkPhotoAlbumFullWindow(current_url,lang_code,is_preview,unid,xml_file,bgColor)
{
	var s_url = IS_getUrlParameter('photo_album_mode');
	if (s_url=='full_window')
	{
		if (IS_getUrlParameter('photo_album_unid')==unid)
		{
			IsIncreasePhotoAlbumView(current_url,lang_code,true,unid,xml_file,bgColor)
			return true;
		}
	}
	return false;
}
///////
function IsLayerManager() 
{
	document.is_layer_manager=this;
	this.mouse=new Object();
}

IsLayerManager.prototype.int_getByKey = function(key)
{
	if (document.all)
	{
		// IE code
		return document.all[key];
	}
	else 
	if(document.layers)
	{
		// NN4.x code
		return document.getElementById(key);	
	}
	if (document.getElementById) 
	{
		return document.getElementById(key);	
	}
} ;


IsLayerManager.prototype.setVisible = function(o,b)
{
	if (o)
	{
	o.style.visibility=(b)?"visible":"hidden";	
	}	
} ;


IsLayerManager.prototype.setSize = function(o,lx,ly)
{
	if (o)
	{	
		o.style.width = ""+lx+"px";
		o.style.height = ""+ly+"px";
	}	
} ;

IsLayerManager.prototype.move = function(o,x,y)
{
	if (o)
	{	
		o.style.left = ""+x+"px";
		o.style.top = ""+y+"px";
	}	
} 

IsLayerManager.prototype.write = function(o,txt)
{
	if (o)
	{
		if (document.layers) 
		{
			
		o.document.open()
		o.document.write(txt)
		o.document.close()
		}
		else
		{
		
			o.innerHTML = '';
			o.innerHTML = txt
		}	
	}	
} ;

IsLayerManager.prototype.getWidth = function(o)
{
	if (o)
	{	
		return extractNum(o.style.width);
	}
	return 0;	
}

IsLayerManager.prototype.getHeight = function(o)
{
	if (o)
	{	
		return extractNum(o.style.height);
	}
	return 0;	
}

IsLayerManager.prototype.setOpacity = function(l,opacity)
{
	if (l)
	{
		try
		{
			if(l.filters)
			{
				l.style.filter="Alpha(opacity="+opacity+")";
			}
			else
			{
				l.style.setProperty("-moz-opacity", opacity/100, "");
				l.style.setProperty("-khtml-opacity", opacity/100, "");
				l.style.setProperty("opacity", opacity/100, "");
			}
		}
		catch (e){}
	}
}

/////////

function IsRect(x,y,lx,ly) 
{
	this.x=x;
	this.y=y;
	this.lx=lx;
	this.ly=ly;
}
////
function IsLayer(id) 
{
	if (!document.is_layer_manager)
	{
		document.is_layer_manager=new IsLayerManager();
	}
	this.layer_manager = document.is_layer_manager;
	this.layer = this.layer_manager.int_getByKey(id);
	
}

IsLayer.prototype.setVisible = function(b)
{
	this.layer_manager.setVisible(this.layer,b)
	this.b_is_visible=b;		
} ;

IsLayer.prototype.setSize = function(lx,ly)
{
	this.layer_manager.setSize(this.layer,lx,ly)	
} ;


IsLayer.prototype.move = function(x,y)
{
	this.layer_manager.move(this.layer,x,y)	
} ;

IsLayer.prototype.write = function(txt)
{
	this.layer_manager.write(this.layer,txt)	
} ;

IsLayer.prototype.getWidth = function()
{
	return this.layer_manager.getWidth(this.layer)	
} ;

IsLayer.prototype.getHeight = function()
{
	return this.layer_manager.getHeight(this.layer)	
};

IsLayer.prototype.relativePoxY = function()
{
	var intern_obj=this.layer
	var intern_curtop = 0;
	if (intern_obj.offsetParent)
	{
		while (intern_obj.offsetParent)
		{
			intern_curtop += intern_obj.offsetTop
			intern_obj = intern_obj.offsetParent;
		}
	}
	else if (intern_obj.y)
		intern_curtop += intern_obj.y;
	return intern_curtop;
};

IsLayer.prototype.setOpacity = function(opacity)
{
	this.layer_manager.setOpacity(this.layer,opacity)	
}




function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



/**********************************************************
(c) 2003-2005, Intuisphere
http://www.intuisphere.fr
**********************************************************/



function getScrollXY() 
{
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement &&
      ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ eval(""+scrOfX), eval(""+scrOfY) ];
}

function qMin(a,b) 
{
	return (a>b)?b:a;
}
function qMax(a,b) 
{
	return (a<b)?b:a;
}


function getWindowWidth() 
{
	var myWidth = 0;
	if( document.body && ( document.body.clientWidth) ) 
	{
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	}
	else
	if( document.documentElement && (document.documentElement.clientWidth) ) 
	{
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	} 
	else
	if( typeof( window.innerWidth ) == 'number' ) 
	{
	//Non-IE
	myWidth = window.innerWidth;
	} 
	return myWidth;
}

function getWindowHeight() 
{
  var myHeight = 0;
  if( document.body && (document.body.clientHeight ) ) 
  {
    //IE 4 compatible
    myHeight = qMax(myHeight,document.body.clientHeight);
  }

  if( document.documentElement && ( document.documentElement.clientHeight ) ) 
  {
    //IE 6+ in 'standards compliant mode'
    myHeight = qMax(myHeight,document.documentElement.clientHeight);
  } 

  if( typeof( window.innerHeight ) == 'number' ) 
  {
    //Non-IE
    myHeight = qMax(myHeight,window.innerHeight);
  } 
   return myHeight;
}

function getWindowScrollX() 
{
	var array = getScrollXY() ;
	return array[0];
}

function getWindowScrollY() 
{
	var array = getScrollXY() ;
	return array[1];
}

function IS_submitPagePassword(pwd)
{
	if (IS_MD5("#"+document.forms['is-password-form'].is_page_password.value+"#")==pwd)
	{
		IS_successPagePassword(pwd);
	}
	else
	{
		IS_writeLayer(getElementByKey("is-password-form-layer-label"),document.is_global_object.messages.page_password_is_wrong);
		document.forms['is-password-form'].is_page_password.focus();
	}
	return false;
}



function IS_successPagePassword(pwd)
{
	var l0 =getElementByKey("is-global-layer");
	l0.style.display="block"
	displayElement(l0,true);
	
	var l =getElementByKey("is-password-form-layer");
	displayElement(l,false);
	l.style.display="none";
	IS_SetCookie("cariboost-password",pwd);
	IE_hackAlphaPngs();
	IS_onload();
	
	
	
}

function IS_checkPagePassword(pwd)
{
	if (IS_GetCookie('cariboost-password')==pwd)
	{
		IS_successPagePassword(pwd);
		return true;
	}
	else
	{
		displayElement(getElementByKey("is-password-form-layer"),true);
		document.forms['is-password-form'].is_page_password.focus();
	}
	return false;
}

function IS_keypressPagePassword(event,pwd)
{
	if (event.keyCode==13) 
	{
		return IS_submitPagePassword(pwd);
	}
	
	return(event.keyCode);
}

function IS_SetCookie (name, value) {
	var argv=IS_SetCookie.arguments;
	var argc=IS_SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	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 IS_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;
}

function IS_displayTooltip(e,s_text)
{
	//
	var x = 0;
	var y = 0;
	if (window.event)
	{
		 e = window.event; 
		 x =  (isDefined(e.pageX))?e.pageX:e.clientX+getWindowScrollX();
		 y = (isDefined(e.pageY))?e.pageY:e.clientY+getWindowScrollY();
	}
	else
	{
		 x = e.pageX;
		 y = e.pageY;	
	}
	 
	if (s_text.length>0)
	{
	
		var l = getElementByKey("is-tooltip");
		s_text = replaceSubstring(s_text," ","&nbsp;");
		IS_writeLayer(l,s_text);
		
		var width = eval(l.clientWidth);
		moveElement(l,x-width/2,y+20);
		displayElement(l,true);
	}	
}

function IS_hideTooltip(e,s_text)
{
	var l = getElementByKey("is-tooltip");
	displayElement(l,false);
}

function encodeToHtml(text)
{
	var result="";
	for (n=0;n<text.length;n++)
	{
		var code = text.charCodeAt(n)
		var current_car = text.charAt(n)
		/*
		if ((code>=120)||(code == 60 )||(code == 38))
		{
			current_car="&#"+code+";";
		}
		if (code>65535)		
		{
			current_car="?";
		}	
		*/
		result+=current_car
	}
	return result;
}

function dump(o)
{
	var obj
	var desc=""
	for (obj in o)
	{
		var nam = ""+obj;
		if (nam.substring(0,2)!="on")
		desc+=" "+obj;	
	}
	alert(desc);
}

function stringStartsWidth (s,startStr) 
{
	if (s.substring(0,startStr.length)==startStr)
	{
		return true;
	}
	return false;
}

/*
function IS_setLayerTransparency(l,opacity)
{
	if (l)
	{
		try
		{
			if(l.filters)
			{
				l.style.filter="Alpha(opacity="+opacity+")";
			}
			else
			{
				l.style.setProperty("-moz-opacity", opacity/100, "");
				l.style.setProperty("-khtml-opacity", opacity/100, "");
				l.style.setProperty("opacity", opacity/100, "");
			}
		}
		catch (e){}
	}
}
*/
function trimString(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}



function IS_innerLayer(l)
{
	
	if (l)
	{
		if (document.layers) 
		{

		l.document.open()
		//l.document.write(txt)
		l.document.close()
		}
		else
		{
			
			return l.innerHTML
		}
	}
	
}

function IS_writeLayer(l,txt)
{
	if (l)
	{
		/*
		if (document.all)
		{
			l.innerHTML = txt
			return 
		}*/
		if (document.layers) 
		{
			
		l.document.open()
		l.document.write(txt)
		l.document.close()
		}
		else
		{
		
			l.innerHTML = '';
			l.innerHTML = txt
		}
		
		
		
		
		
	}
	
}

function getElementByKey(str)
{
	if (document.all)
	{
		// IE code
		return document.all[str];
	}
	else 
	if(document.layers)
	{
		// NN4.x code
		return document.getElementById(str);	
	}
	if (document.getElementById) 
	{
		return document.getElementById(str);	
	}
}

function displayElement(o,state)
{
	if (o)
	{
		o.style.visibility=(state)?"visible":"hidden";	
		
	}
}

function extractNum(st)
{
	var len  = st.length
	if ((len>0)&&(st.substring(len-2,len)=="px"))
	{
		return eval(st.substring(0,len-2))
	}
	return 0;

}

function getPositionX(o)
{
	if (o)
	{
		return extractNum(o.style.left);
	}
	return 0;
}

function getPositionY(o)
{
	if (o)
	{	
	return extractNum(o.style.top);
	}
	return 0;	
}

function getWidth(o)
{
	if (o)
	{	
	return extractNum(o.style.width);
	}
	return 0;	
}

function getHeight(o)
{
	if (o)
	{	
	return extractNum(o.style.height);
	}
	return 0;	
}

function setSize(o,lx,ly)
{
	if (o)
	{	
		o.style.width = ""+lx+"px";
		o.style.height = ""+ly+"px";
	}	
}

function moveElement(o,x,y)
{
	if (o)
	{
		o.style.left = ""+x+"px";
		o.style.top = ""+y+"px"
	}
}

function getZindex(o)
{
	if (o)
	{	
		return o.style.zIndex;
	}
	return -1;	
}

function setZindex(o,index)
{
	if (o)
	{	
		o.style.zIndex = index;
	}
}

function isDefined(v) 
{ 
	var undef;
	return v!=undef;
}

function copyExtendedTextStyle(src,dest)
{
	if (src)
	{
		dest.textDecoration = src.textDecoration
		dest.color = src.color
		
		dest.backgroundColor = src.backgroundColor
		dest.backgroundImage = src.backgroundImage
	}
}

function fillExtendedTextStyle(obj_style,style_text)
{
	if (obj_style)
	{
		style_text = ";"+style_text+";";
		var tab;
		tab = style_text.match(/;color:(#[0123456789abcdef]+)/i)
		if (tab) obj_style.color=tab[1]
		tab = style_text.match(/;text-decoration:([a-z]+)/i)
		if (tab) obj_style.textDecoration=tab[1]
		
		
		tab = style_text.match(/;background-color:(#[0123456789abcdef]+)/i)
		if (tab) obj_style.backgroundColor=tab[1]	
		
		tab = style_text.match(/;background-image:([^;]+);/i)
		if (tab) obj_style.backgroundImage=tab[1]
		
						
	}
}


function applyTextStyle(p_this,style_text)
{
	if (p_this && style_text && (style_text.length>0))
	{
		p_this.old_text_style = new Object();
		copyExtendedTextStyle(p_this.style,p_this.old_text_style);
		fillExtendedTextStyle(p_this.style,style_text);
	}	
}

function restoreTextStyle(p_this)
{
	if (p_this)
	{
		copyExtendedTextStyle(p_this.old_text_style,p_this.style);
	}
}

function IS_open_url(url,s_target)
{
	if (s_target=="")
	{
		//this.location.replace(url);
		this.location = url;
	}
	else
	{
		window.open(url,s_target);
	}
}

function replaceSubstring ( inputString, badString, goodString, caseSensitive ) {
fixedReplace = " ";
UI = inputString;
UB = badString;
if ((caseSensitive !=1) && (caseSensitive != true)) {
UI = inputString.toUpperCase();
UB = badString.toUpperCase();
}
badEnd = -1;
badLoc = UI.indexOf(UB);
if (badLoc != -1) {
for (x=1; (badLoc != -1); x++) {
fixedReplace = fixedReplace + inputString.substring((badEnd + 1), badLoc) + goodString
badEnd = badLoc + UB.length - 1;
badLoc = UI.indexOf(UB, (badLoc + 1)); }
fixedReplace = fixedReplace + inputString.substring((badEnd + 1), inputString.length); }
else { fixedReplace = inputString; }
fixedReplace = trimString(fixedReplace);
return fixedReplace;
}

function roundTowardsZero(n) {
  return (n<0?-1:+1)*Math.floor(Math.abs(n)) 
}	

function IS_getIntegerUrlParameter(parameterName ) 
{
	var s = IS_getUrlParameter(parameterName)
	if (s!="null")
	return eval(s);
	return "null";
}

function IS_getUrlParameter (parameterName ) 
{
	// Add "=" to the parameter name (i.e. parameterName=value)
	var queryString = window.location+""
	var parameterName = parameterName + "=";
	if ( queryString.length > 0 ) 
	{
		// Find the beginning of the string
		var begin = queryString.indexOf ( parameterName );
		// If the parameter name is not found, skip it, otherwise return the value
		if ( begin != -1 ) 
		{
			// Add the length (integer) to the beginning
			begin += parameterName.length;
			// Multiple parameters are separated by the "&" sign
			var end = queryString.indexOf ( "&" , begin );
			if ( end == -1 ) 
			{
			end = queryString.length
			}
			// Return the string
			return unescape ( queryString.substring ( begin, end ) );
		}
		// Return "null" if no parameter has been found
		return "null";
	}
	return "null";
}


function internal_IS_comp_initialize_handlers_type1(key,b_has_event_param)
{
	var on_handler = document.intuisphere_handlers[key];
	if (on_handler)
	{
		var fct_handler = function(e)
		{
			if (b_has_event_param)
			{
				if (document.all) e = window.event;
			}
		
			if (key=="onmousemove")
			{
				if (document.is_layer_manager)
				{
					document.is_layer_manager.mouse.x = e.clientX;
					document.is_layer_manager.mouse.y = e.clientY;
				}	
			}		
			var return_value = true;
			for (var i=0;i<on_handler.length;i++)
			{
				if (b_has_event_param)
				{
					if (eval("IS_handler_"+key+"_comp_"+on_handler[i]+"(e)")==false)
					{
						return_value = false; 
					}
				}
				else
				{
					if (eval("IS_handler_"+key+"_comp_"+on_handler[i]+"()")==false)
					{
						return_value = false; 
					}
				}
			}
			
			
			return return_value;
			//return true;
		}
		
		if (key=="onmousewheel")
		{
			if (window.addEventListener) 
			{
				window.addEventListener("DOMMouseScroll",fct_handler, false);
			}
			else 
			{ 
				document.onmousewheel = fct_handler; 
			}			
		}
		else
		{
			eval ("document."+key+" = fct_handler")
		}
	}	
}

function IS_comp_initialize_handlers(array)
{
	document.intuisphere_handlers = new Array();
	
	for (var i=0;i<array.length;i++)
	{
		var s = array[i];
		
		var n = s.indexOf ("@");
		if (n>-1)
		{
			id = s.substring(n+1);
			var handlers = s.substring(0,n).split("-");
			for (var h=0;h<handlers.length;h++)
			{
				if (!document.intuisphere_handlers[handlers[h]])
				{
					document.intuisphere_handlers[handlers[h]] = new Array();
				}
				var l = document.intuisphere_handlers[handlers[h]].length
				document.intuisphere_handlers[handlers[h]][l]=id;
			}
			
		}
	}	
/////onload handlers
	var onload_handler = document.intuisphere_handlers['onload'];
	if (onload_handler)
	{
		//alert('onload_handler '+onload_handler.length)
		for (var i=0;i<onload_handler.length;i++)
		{
			eval("IS_handler_onload_comp_"+onload_handler[i]+"()")
		}
		//alert('onload_handler2')
	
	}
	internal_IS_comp_initialize_handlers_type1("onkeypress",true);
	internal_IS_comp_initialize_handlers_type1("onkeydown",true);
	internal_IS_comp_initialize_handlers_type1("onmousemove",true);
	internal_IS_comp_initialize_handlers_type1("onmousewheel",true);

	internal_IS_comp_initialize_handlers_type1("onmousedown",false);
	internal_IS_comp_initialize_handlers_type1("onclick",false);
}

function IE_hackAlphaPngs()
{
}


function IS_blockRightClick()
{
	if (window.Event) 
	document.captureEvents(Event.MOUSEUP); 
	function nocontextmenu() 
	{ 
		event.cancelBubble = true 
		event.returnValue = false; 
		return false; 
	} 
	
	function IS_blockIEContextMenu_fct()
	{
		return false;
	}
	
	function norightclick(e) 
	{ 
		if (window.Event) 
		{ 
			if (e.which == 2 || e.which == 3) 
			return false; 
		} 
		else 
		if (event.button == 2 || event.button == 3) 
		{ 
			event.cancelBubble = true 
			event.returnValue = false; 
			return false; 
		} 
	} 
	
	window.oncontextmenu=IS_blockIEContextMenu_fct
	document.oncontextmenu = nocontextmenu; 
	document.onmousedown = norightclick; 
}


//-->