/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Build: http://www.modernizr.com/download/#-hashchange-iepp-cssclasses-hasevent-load
 */
;window.Modernizr=function(a,b,c){function y(a,b){return!!~(""+a).indexOf(b)}function x(a,b){return typeof a===b}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function v(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n={},o={},p={},q=[],r=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=x(e[d],"function"),x(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),s,t={}.hasOwnProperty,u;!x(t,c)&&!x(t.call,c)?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],c)},n.hashchange=function(){return r("hashchange",a)&&(b.documentMode===c||b.documentMode>7)};for(var z in n)u(n,z)&&(s=z.toLowerCase(),e[s]=n[z](),q.push((e[s]?"":"no-")+s));v(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e.hasEvent=r,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+q.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};


var ajaxAnywhereDefaultloadingMessage = "Loading...";

function popUpImage(id, width, height, title){
    showImage(id, title);
}

function popUpOrigImage(id, width, height, title){
    var content = "<html><head><title>" + title + "</title><style type=\"text/css\">body{margin: 0; padding: 0;}</style></head><body><img style=\"cursor: pointer\" onclick=\"window.close()\" src=\"/ferd/image.do?orig_id=" + id + "&w="+width+"\" border=\"0\"></body></html>";
    var popupimage = window.open("", "popupimage", "width=" + width + ",height=" + height + ",status=no,resizable=yes,scrollbars=0,top=200,left=400");
    popupimage.focus();
    popupimage.opener = self;
    var popupDoc = popupimage.document;
    popupDoc.innerHTML = "";
    popupDoc.write (content);
    popupimage.resizeTo(width,height+2);
    var pWidth = popupDoc.documentElement.offsetWidth;
    var pHeight = popupDoc.documentElement.offsetHeight;
    popupDoc.close();
    if ( width > pWidth || height > pHeight ){
	popupimage.resizeTo(2*width-pWidth+4,2*height-pHeight+5);
    }
}

function openMap() {
	var url = document.location.pathname + "?page=49";
	var popup = window.open(url, "map", "resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no,width=430,height=720" );
	popup.focus();
}
function Openme(newin) {
    var flyout=window.open(newin,"flyout","resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no,width=420,height=400");
	flyout.focus();
}

function showPrintPage(){
	var url = document.location + "&printpage=true"
    var width = 750;
    var height = 600;
    var printPage = window.open(url, "printpage", "width=" + width + ",height=" + height + ",toolbar=1,menubar=1,status=no,resizable=yes,scrollbars=1,top=100,left=100");
    printPage.focus();
	printPage.onload = printPage.print;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages(lang) {
	if (document.images) {
		invest_over = newImage("docs/images/menub/"+lang+"/invest-over.jpg");
		eiendom_over = newImage("docs/images/menub/"+lang+"/eiendom-over.jpg");
		venture_over = newImage("docs/images/menub/"+lang+"/venture-over.jpg");
		konsern_over = newImage("docs/images/menub/"+lang+"/konsern-over.jpg");
		principal_over = newImage("docs/images/menub/"+lang+"/principal-over.jpg");
		equity_over = newImage("docs/images/menub/"+lang+"/equity-over.jpg");
		elopak_over = newImage("docs/images/menub/"+lang+"/elopak-over.jpg");
		preloadFlag = true;
	}
}

function clearSearchBox(el){
    if(el.value == "Search:" || el.value == "Søk:"){
        el.oldValue = el.value;
        el.value = "";
        el.onblur = function(){
            if(this.value == "" && this.oldValue){
                this.value = this.oldValue;
            }
        }
    }
}

function placeElementCentered(element) {
    element.style.display = "";
    var documentHeight = document.documentElement.offsetHeight ? document.documentElement.offsetHeight:document.body.offsetHeight;
    var documentWidth =  document.documentElement.offsetWidth ? document.documentElement.offsetWidth:document.body.offsetWidth;
    var popupWidth =     element.offsetWidth;
    var popupHeight =    element.offsetHeight;
    var scrollX = document.body.scrollLeft ? document.body.scrollLeft:document.documentElement.scrollLeft;
    var scrollY = document.body.scrollTop ? document.body.scrollTop:document.documentElement.scrollTop;
    var x = Math.floor((documentWidth/2) - (popupWidth/2));
    var y = Math.floor((documentHeight/2) - (popupHeight/2));
    y = y + scrollY < 0 ? 0:y + scrollY;
    x = x + scrollX < 0 ? 0:x + scrollX;
  
    element.style.top = y +  "px";
    element.style.left = x + "px";
}



function showImage(image, title){
	var ic = $("imageContainer");

    //get imageContainer
    if(!ic){
        ic = document.createElement("div");
        ic.style.position = "absolute";
        ic.className = "imageContainer";
        ic.id = "imageContainer";
        ic.style.display = "none";
        document.body.appendChild(ic);
    }

    if(ic){
	    ic.style.visibility = "hidden";
	    ic.style.display  = "";
        ic.innerHTML = "";
        var a = document.createElement("a");
        a.onclick = function(){hideImage()};
        a.innerHTML = "[ x ]";
        ic.appendChild(a);
        var img = document.createElement("img");
        if(parseInt(image) > 0){
            img.src = "/image.do?id=" + image;
        }else{
            img.src = image;
        }
        img.alt = title;
        img.onload = function(){
	        placeElementCentered(ic);
	        ic.style.visibility = "visible";
        };
        img.onclick = function(){hideImage()};
        ic.appendChild(img);
    }
}

function hideImage(){
	var ic = $("imageContainer");
    if(ic){
        ic.style.display = "none";
    }
}

function log(txt){
    if(window.console){
        window.console.log(txt);
    }
}

function getAjaxForMap(map, async, callback){
    var url = "show.do";

	map = $H(map);
	if(!map.get("page")) {
		map.set("page", "186");
    }

    if(!map.get("appmode")) {
		map.set("appmode", "/tipFriend");
    }

   url += "?" + map.toQueryString();

	var myAjax;
	if(async){
		myAjax = getFreeAjax();
	}else{
		myAjax = ajaxAnywhere;
	}
	if(callback == undefined){
		myAjax.onAfterResponseProcessing =  function(){}
	}else{
		myAjax.onAfterResponseProcessing =  function(){
			//log("jeg skal kjøre callbacken");
			eval(callback);
		}
	 }
	myAjax.getAJAX(url);
}

var ajaxmap = new Array();

function getFreeAjax(){
   // log("getFreeAjax: size: " + ajaxmap.length);
    for(var i=0;i<ajaxmap.length;i++){
        if(ajaxmap[i].req.readyState == 0 || ajaxmap[i].req.readyState == 4) {
            //log("fant en brukt en: " + ajaxmap[i]);
            return ajaxmap[i];
        }
    }
    //we didn't return any thing. Lets make a new one
    var newId = ajaxmap.length;
    ajaxmap[newId] =  new AjaxAnywhere();
    ajaxmap[newId].bindById();
    //log("laget en ny: " + newId);
    return ajaxmap[newId];
}

function submitAJAX(formName, ajaxAnywhereInstance){
	var _localAjaxAnywhere = (ajaxAnywhereInstance != undefined ? ajaxAnywhereInstance : ajaxAnywhere);
    _localAjaxAnywhere.formName = formName;
    _localAjaxAnywhere.submitAJAX();
    return false;
}


function getZone(zoneName){
	zoneName = "aazone." + zoneName;
	if($(zoneName)){
		return $(zoneName);
	} else {
		var zone = document.createElement("div");
		zone.style.display = "inline";
		zone.id = zoneName;
		document.body.appendChild(zone);
		return zone;
	}
}




/*thisIsFerd*/
var thisIsFerdBackgrounds = [
	"files/ferd/gfx/thisIsFerd/image1.jpg",
	"files/ferd/gfx/thisIsFerd/image2.jpg",
	"files/ferd/gfx/thisIsFerd/image3.jpg",
	"files/ferd/gfx/thisIsFerd/image4.jpg",
	"files/ferd/gfx/thisIsFerd/image5.jpg",
	"files/ferd/gfx/thisIsFerd/image6.jpg"
];

var fadeInCounter = 1;
var thisIsFerdChangeTime = 10000;

function fadeOutThisIsFerd() {
	var front = document.getElementById("thisIsFerdFront");
	var back = document.getElementById("thisIsFerdBack");
	if(front.style.opacity > 0) {
		var opacity = front.style.opacity*1 - 0.1;
		setOpacity(front, opacity);
		setTimeout("fadeOutThisIsFerd()", 200);
	} else {
		fadeInCounter++;		
		front.style.backgroundImage = back.style.backgroundImage;
		setOpacity(front, 1);
		if(fadeInCounter >= thisIsFerdBackgrounds.size()) {
			fadeInCounter = 0;
		}
		back.style.backgroundImage = "url(" + thisIsFerdBackgrounds[fadeInCounter] + ")";
		setTimeout("fadeOutThisIsFerd()", thisIsFerdChangeTime);
	}
}

function setOpacity(el, value) {
	el.style.opacity = value;
	el.style.filter = 'alpha(opacity=' + value*100 + ')';
}

var imageArray = new Array();
function startThisIsFerd() {
	thisIsFerdBackgrounds.each( function (src) {
		var img = new Image();
		img.src = src;
		imageArray[imageArray.length] = img;
	});
	var front = document.getElementById("thisIsFerdFront");
	front.style.opacity = 1;
	setTimeout("fadeOutThisIsFerd()", thisIsFerdChangeTime);
}

function openAsPopup(event, el) {
    if(!el || !el.href) return;
    Event.stop(event);
    var win = window.open(el.href, "ferd_popup", "status=no,toolbar=no,menubar=no,location=no");
    win.focus();
}


var HistoryList = {
	current : undefined,

	setAsCurrent : function(el) {
		el = $(el);
		this.selectOnlyThis(el);
		this.updateDetail(el.up().down("div.historyListItemDetail").innerHTML);
		this.updateListHeight();
	},

	selectOnlyThis : function(el) {
		el = $(el);
		this.deselectCurrent();

		el.addClassName("historyListItemSelected");
		this.current = el;
	},

	deselectCurrent : function() {
		if(this.current) {
			this.current.removeClassName("historyListItemSelected");
			this.current = undefined;
		}
	},

	updateListHeight : function() {
//		$("historyListScroller").style.height = $("historyListItemContainer").up(".historyDisplay").offsetHeight + "px";
	},

	updateDetail : function(content) {
		$("historyListItemContainer").update(content);
	},

	setMainAsCurrent : function() {
		this.deselectCurrent();
		var mainArticleContainer = $("historyListMainArticle").down("div.historyListItemDetail");
		this.updateDetail(mainArticleContainer ? mainArticleContainer.innerHTML:"");
	}

};


	var RealEstateShow = (function(){

		function getLargeImageContainer() {
			return $("realEstateImages").down(".imageLarge");
		}

		function getLargeImageForNr(imageNr) {
			return getLargeImageContainer().down(".image"+imageNr);
		}

		function getActiveLargeImage() {
			return getLargeImageContainer().down(".activeImage");
		}

		function switchToNewLargeImage(newImage) {
			var activeImage = getActiveLargeImage();

			if(newImage && newImage != activeImage ) {
				activeImage.removeClassName("activeImage");
				newImage.addClassName(("activeImage"));
			}
		}

		function showCorrectImage(imageNr) {
			switchToNewLargeImage(getLargeImageForNr(imageNr));
		}


		function displayNextImageInList() {
			var activeImage = getActiveLargeImage();
			switchToNewLargeImage(activeImage.next("img") || activeImage.up().down("img"));
		}

		return {
			displayImage : function(imageNr) {
				showCorrectImage(imageNr);
			},

			showNextImage : function() {
				displayNextImageInList();
			}
		}
	})();


var OrderProspect = (function(){

	var getResponse = function (params) {
		getOrderZone();
		params = $H(params);
		params.set("appname", "ferd");
		params.set("appmode", "/orderProspect");
		getAjaxForMap(params);
	};

	var getOrderZone = function() {
		return getZone("orderProspect");
	};

	return {
		openDialog : function (articleId, localeCode) {
			getResponse({ action : "open", articleId : articleId, localeCode : localeCode});
		},

		closeDialog : function() {
			Element.update(getOrderZone(), "");
		},

		send : function (el) {
			el.onclick = function() {
				return false;
			}
		}

	}
})();


var ConferenceRegistration = (function(){

	var getResponse = function (params) {
		getThisZone();
		params = $H(params);
		params.set("appname", "ferd");
		params.set("appmode", "/conferenceRegistration");
		getAjaxForMap(params);
	};

	var getThisZone = function() {
		return getZone("conferenceRegistration");
	};

	return {
		openDialog : function (registrationType) {
			getResponse({ action : "open", registrationType : registrationType });
		},

		closeDialog : function() {
			Element.update(getThisZone(), "");
		},

		send : function (el) {
			el.onclick = function() {
				return false;
			}
		}

	}
})();


function browserTest(){
    var agt=navigator.userAgent.toLowerCase();

    is_DOM = (document.getElementById) ? true : false;
    var is_opera = (agt.indexOf("opera") != -1) ? true:false;
    var is_konq = agt.indexOf('konqueror') != -1 ? true:false;
    var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
    var is_khtml  = (is_safari || is_konq);
    var is_gecko = ((!is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
    var is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                    (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                    (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                    (is_gecko) &&
                    ((navigator.vendor=="")||(navigator.vendor=="Mozilla")));

    //alert("Opera: " + is_opera + "\nKonqueror: " + is_konq + "\nSafari: " + is_safari + "\nKhtml: " + is_khtml + "\nMozilla: " + is_moz);
    if ( is_DOM && (is_konq || is_opera) ){
    if ( document.getElementById('theBanner') && document.getElementById('theBanner').getElementsByTagName("div")[0]){
        document.getElementById('theBanner').getElementsByTagName("div")[0].style.backgroundColor = "transparent";
    }
    }
}

/* get mouse position */
var Mouse = {x:0, y:0};

document.onmousemove = function (evt) {
    var e = window.event || evt;
    //    Mouse.x = e.x || e.pageX || 0;
    //Mouse.y = e.y || e.pageY || 0;
    Mouse.x = e.pageX | e.clientX  || 0;
    Mouse.y = e.pageY || e.clientY + document.body.scrollTop || 0;
}
/* get mouse position end */


/*Hover Effect on Popup images */
function popupTitle(image, txt){
    var newDiv = document.createElement("div");
    newDiv.className = "mouseOverText";
    newDiv.innerHTML = txt;

    var newDivShadow = document.createElement("div");
    newDivShadow.className = "mouseOverTextShadow";

    document.body.appendChild(newDivShadow);
    document.body.appendChild(newDiv);

    image.mot = newDiv;
    image.motS = newDivShadow;


    image.onmouseover = function(){
    image.mot.style.visibility = "visible";
    image.motS.style.visibility = "visible";
    };

    image.onmousemove = function(){

    var left  = Mouse.x - 20;
    if ( (left + this.mot.offsetWidth) > (document.body.offsetWidth - 40 )){
        left = document.body.offsetWidth - this.mot.offsetWidth - 40;
    }

    var top = Mouse.y + 20;
    if (( top + this.mot.offsetHeight) > (document.body.offsetHeight - 20 )){
        top = Mouse.y - this.mot.offsetHeight - 20;
    }
    //this.mot.innerHTML =  (left + this.mot.offsetWidth) + " > " + (document.body.offsetWidth-50) + " = " + left;

    this.mot.style.left = left + "px";
    this.mot.style.top = top + "px";

    this.motS.style.left = this.mot.offsetLeft + 5 + "px";
    this.motS.style.top = this.mot.offsetTop + 5 + "px";

    this.motS.style.width = this.mot.offsetWidth + "px";
    this.motS.style.height = this.mot.offsetHeight + "px";

    }
    image.onmouseout = function(){
    image.mot.style.visibility = "hidden";
    image.motS.style.visibility = "hidden";
    };

    //to make it work the first time we hover the image
    image.mot.style.visibility = "visible";
    image.motS.style.visibility = "visible";
    if ( image.style.cursor ){
    image.style.cursor = "pointer";
    }
}


/*Hover Effect on Popup images */

