function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}
func();};}}
function addUnloadEvent(func){var oldonunload=window.onunload;if(typeof window.onunload!='function'){window.onunload=func;}else{window.onunload=function(){if(oldonunload){oldonunload();}
func();};}}
function getElementsByClassName(oElm,strTagName,strClassName){var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);var arrReturnElements=[];strClassName=strClassName.replace(/\-/g,"\\-");var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");var oElement;for(var i=0;i<arrElements.length;i++){oElement=arrElements[i];if(oRegExp.test(oElement.className)){arrReturnElements.push(oElement);}}
return(arrReturnElements);}
function externalLinks()
{if(!document.getElementsByTagName){return;}
var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external"){anchor.target="_blank";}}}
function augment(oSelf,oOther){if(oSelf===null){oSelf={};}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(typeof(o)!='undefined'&&o!==null){for(var j in o){oSelf[j]=o[j];}}}
return oSelf;}
function InternetExplorer(){return(navigator.appName=="Microsoft Internet Explorer");}
function includeJsFile(f){var s=document.createElement("script");s.type="text/javascript";s.src=f;document.getElementsByTagName("head")[0].appendChild(s);return true;}
function OD_Tooltip(jq)
{var self=this;this.init=function()
{this.jq=jq;if(!jq){this.jq="*";}
this.iTimeoutId=null;this.toolTip=this.createToolTipContainer();this.toolTipContent = document.createElement("div"); $(this.toolTipContent).addClass("imm_tooltip-content"); this.toolTip.appendChild(this.toolTipContent);this.hideToolTip();this.aTargets=this.getTargets();this.setEvents(this.aTargets);return true;};this.createToolTipContainer=function()
{var divToolTip=document.createElement("div");divToolTip.id="imm_tooltip";$(divToolTip).addClass("imm_tooltip");document.body.appendChild(divToolTip);return divToolTip;};this.hideToolTip=function()
{this.toolTipContent.innerHTML="";this.toolTip.style.display="none";return true;};this.getTargets=function()
{if(this.jq=="*"){this.jq="*[title!=]";}
return $(this.jq);};this.setEvents=function(aTargets)
{$(aTargets).each(function(){if($(this).attr("title")){$(this).attr("tooltip",$(this).attr("title"));$(this).attr("title","");this.onmouseover=function(e)
{self.hideToolTip();var aPosition=self.getMousePosition(e);self.showToolTip(this.getAttribute("tooltip"),aPosition);};this.onmouseout=function(e)
{self.hideToolTip();};}});return true;};this.showToolTip=function(sValue,aPosition)
{this.toolTipContent.innerHTML=sValue;this.toolTip.style.display="block";var posX=aPosition[0];var posY=aPosition[1];var sWindowHeight=0;var sWindowWidth=0;if(document.documentElement.clientHeight){sWindowHeight=document.documentElement.clientHeight;sWindowWidth=document.documentElement.clientWidth;}else{sWindowHeight=document.body.clientHeight;sWindowWidth=document.body.clientWidth;}
if(posX+this.toolTip.offsetWidth<sWindowWidth){this.toolTip.style.left=posX+10+"px";}else{this.toolTip.style.right=0;}
if((posY+this.toolTip.offsetHeight)<sWindowHeight){this.toolTip.style.top=posY+18+"px";}else{this.toolTip.style.top=posY-15-this.toolTip.offsetHeight+"px";}
return true;};this.includeJsFile=function(sFilename)
{var includeScript=document.createElement("script");$(includeScript).attr("src",sFilename);$(includeScript).attr("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(includeScript);return true;};this.augment=function(oSelf,oOther)
{if(oSelf===null){oSelf={};}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(typeof(o)!='undefined'&&o!==null){for(var j in o){oSelf[j]=o[j];}}}
return oSelf;};this.getMousePosition=function(e){var posX=null;var posY=null;if(!e){e=window.event;}
if(e.pageX||e.pageY){posX=e.pageX;posY=e.pageY;}else if(e.clientX||e.clientY){posX=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posY=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
var aPosition=[posX,posY];return aPosition;};addLoadEvent(function(){self.init();});}
function IMM_Alert(sMessage,oOptions)
{this.m=sMessage;this.d=null;this.centered=true;this.oOptions=augment({posX:false,posY:false,type:'message'},oOptions);this.random=Math.floor(Math.random()*11);this.init=function()
{if(!this.oOptions.posY){this.oOptions.posY=this.getCenterY();}else{this.centered=false;}
if(!this.oOptions.posX){this.oOptions.posX=this.getCenterX();}else{this.centered=false;}
this.setMessage();};this.getCenterX=function()
{return($(window).width()/2)-100;};this.getCenterY=function()
{return($(window).height()/2)-300;};this.setMessage=function()
{var r=this.random;this.d=document.createElement("div");this.d.id="imm_Alert"+r;this.d.className="js-alert js-alert-"+this.oOptions.type;this.d.innerHTML=this.m;if(this.centered){this.oOptions.posY=this.oOptions.posY-this.d.offsetHeight;this.oOptions.posX=this.oOptions.posX-this.d.offsetWidth;}else{this.oOptions.posY=this.oOptions.posY+10;this.oOptions.posX=this.oOptions.posX+10;}
this.d.style.top=parseInt(this.oOptions.posY,10)+"px";this.d.style.left=parseInt(this.oOptions.posX,10)+"px";document.body.appendChild(this.d);this.showHide();};this.showHide=function()
{var self=this;var r=this.random;$("#imm_Alert"+r).fadeIn("slow",function(){setTimeout(function(){$("#imm_Alert"+r).fadeOut("slow",function(){$("#imm_Alert"+r)[0].parentNode.removeChild($("#imm_Alert"+r)[0]);});},self.GetShowTime());});};this.GetShowTime=function()
{return this.m.length*60;};this.init();}
function IMM_Loader(oContainer)
{this.c=null;this.cP=null;this.cL=null;this.cT=null;this.init=function()
{this.c=oContainer;};this.show=function()
{this.loadingMask=document.createElement("div");this.loadingDiv=document.createElement("div");$(this.loadingMask).addClass("loading-mask");$(this.loadingDiv).addClass("loading-image");this.loadingDiv.innerHTML="Loading...";this.cP=$(this.c).css("position");this.cL=$(this.c).css("left");this.cT=$(this.c).css("top");$(this.c).css("position","relative");$(this.c).css("top","0");$(this.c).css("left","0");this.c.appendChild(this.loadingMask);this.c.appendChild(this.loadingDiv);};this.hide=function()
{$(this.loadingDiv).remove();$(this.loadingMask).remove();$(this.c).css("position",this.cP);$(this.c).css("top",this.cT);$(this.c).css("left",this.cL);};this.init();}
function debug(s){if(typeof window.console !="undefined") {window.console.log(s);}}
function CheckValidDate(date, oOptions)
{
	oOptions = augment({
		format: "dd-mm-jjjj"	
	}, oOptions);
	var index1 = oOptions.format.indexOf("-");
	var index2 = oOptions.format.lastIndexOf("-");
	var valid = false;
	if(date.substr(index1,1) == "-" && date.substr(index2,1) == "-") { valid = true;}	
	return valid;
}
