
function mouseover( cond,cond2){
switch (cond) {

   case 1 :
            document.getElementById("bar").src = "images/bar1.png"; 
            if(cond2!=1) slides1[0].over();
            break; 
   case 2 :
            document.getElementById("bar").src = "images/bar2.png"; 
            if(cond2!=1) slides1[1].over();
            break;
   case 3 :
            document.getElementById("bar").src = "images/bar3.png"; 
            if(cond2!=1) slides1[2].over();
            break;
   default:

} 


}
var slides1 = [];
/* ==== slider nameSpace ==== */
var slider = function() {
	/* ==== private methods ==== */
	function getElementsByClass(object, tag, className) {
		var o = object.getElementsByTagName(tag);
		for ( var i = 0, n = o.length, ret = []; i < n; i++) {
			if (o[i].className == className) ret.push(o[i]);
		}
		if (ret.length == 1) ret = ret[0];
		return ret;
	}
	function setOpacity (obj,o) {
		if (obj.filters) obj.filters.alpha.opacity = Math.round(o);
		else obj.style.opacity = o / 100;
	}
	/* ==== Slider Constructor ==== */
	function Slider(oCont, speed, iW, iH, oP) {
		this.slides = [];
		this.over   = false;
		this.S      = this.S0 = speed;
		this.iW     = iW;
		this.iH     = iH;
		this.oP     = oP;
		this.oc     = document.getElementById(oCont);
		this.frm    = getElementsByClass(this.oc, 'div', 'slide');
		this.NF     = this.frm.length;
		this.resize();
		for (var i = 0; i < this.NF; i++) {
			this.slides[i] = new Slide(this, i);
			slides1[i] = this.slides[i];
		}
		this.oc.parent = this;
		this.view      = this.slides[0];
		this.Z         = this.mx;
		/* ==== on mouse out event ==== */
		this.oc.onmouseout = function () {
			this.parent.mouseout();
			return false;
		}
	}
	Slider.prototype = {
		/* ==== animation loop ==== */
		run : function () {
			this.Z += this.over ? (this.mn - this.Z) * .5 : (this.mx - this.Z) * .5;
			this.view.calc();
			var i = this.NF;
			while (i--) this.slides[i].move();
		},
		/* ==== resize  ==== */
		resize : function () {
			this.wh = this.oc.clientWidth;
			this.ht = this.oc.clientHeight;
			this.wr = this.wh * this.iW;
			this.r  = this.ht / this.wr;
			this.mx = this.wh / this.NF;
			this.mn = (this.wh * (1 - this.iW)) / (this.NF - 1);
		},
		/* ==== rest  ==== */
		mouseout : function () {
			this.over      = false;
			setOpacity(this.view.img, this.oP);
		}
	}
	/* ==== Slide Constructor ==== */
	Slide = function (parent, N) {
		this.parent = parent;
		this.N      = N;
		this.x0     = this.x1 = N * parent.mx;
		this.v      = 0;
		this.loaded = false;
		this.cpt    = 0;
		this.start  = new Date();
		this.obj    = parent.frm[N];
		this.txt    = getElementsByClass(this.obj, 'div', 'text');
		this.img    = getElementsByClass(this.obj, 'img', 'diapo');
		this.bkg    = document.createElement('div');
		this.bkg.className = 'backgroundText';
		this.obj.insertBefore(this.bkg, this.txt);
		if (N == 0) this.obj.style.borderLeft = 'none';
		this.obj.style.left = Math.floor(this.x0) + 'px';
		setOpacity(this.img, parent.oP);
		/* ==== mouse events ==== */
		this.obj.parent = this;
		this.obj.onmouseover = function() {
			this.parent.over();
			return false;
		}
	}
	Slide.prototype = {
		/* ==== target positions ==== */
		calc : function() {
			var that = this.parent;
			// left slides
			for (var i = 0; i <= this.N; i++) {
				that.slides[i].x1 = i * that.Z;
			}
			// right slides
			for (var i = this.N + 1; i < that.NF; i++) {
				that.slides[i].x1 = that.wh - (that.NF - i) * that.Z;
			}
		},
		/* ==== HTML animation : move slides ==== */
		move : function() {
			var that = this.parent;
			var s = (this.x1 - this.x0) / that.S;
			/* ==== lateral slide ==== */
			if (this.N && Math.abs(s) > .5) {
				this.obj.style.left = Math.floor(this.x0 += s) + 'px';
			}
			/* ==== vertical text ==== */
			var v = (this.N < that.NF - 1) ? that.slides[this.N + 1].x0 - this.x0 : that.wh - this.x0;
			if (Math.abs(v - this.v) > .5) {
				this.bkg.style.top = this.txt.style.top = Math.floor(2 + that.ht - (v - that.Z) * that.iH * that.r) + 'px';
				this.v = v;
				this.cpt++;
			} else {
				if (!this.pro) {
					/* ==== adjust speed ==== */
					this.pro = true;
					var tps = new Date() - this.start;
					if(this.cpt > 1) {
						that.S = Math.max(2, (28 / (tps / this.cpt)) * that.S0);
					}
				}
			}
			if (!this.loaded) {
				if (this.img.complete) {
					this.img.style.visibility = 'visible';
					this.loaded = true;
				}
			}
		},
		/* ==== light ==== */
		over : function a() {

		    if ((""+this.img.src).indexOf("localization_news_")>0) {
		    mouseover(1,1);
		    }
		    else if ((""+this.img.src).indexOf("localization_tools_")>0) {
		    mouseover(2,1);
			    }
		    else if ((""+this.img.src).indexOf("localization_forum_")>0) {
		    mouseover(3,1);
		    }
			this.parent.resize();
			this.parent.over = true;
			setOpacity(this.parent.view.img, this.parent.oP);
			this.parent.view = this;
			this.start = new Date();
			this.cpt = 0;
			this.pro = false;
			this.calc();
			setOpacity(this.img, 100);
		}
	}
	/* ==== public method - script initialization ==== */
	return {
		init : function() {
		    var picSet = random(7);
	        document.getElementById("sliderImage1").src="images/localization_news_"+picSet+".jpg";
	        document.getElementById("sliderImage2").src="images/localization_tools_"+picSet+".jpg";
	        document.getElementById("sliderImage3").src="images/localization_forum_"+picSet+".jpg";
            setPos();
			// create instances of sliders here
			// parameters : HTMLcontainer name, speed (2 fast - 20 slow), Horizontal ratio, vertical text ratio, opacity
			this.s1 = new Slider("slider", 12, 1.84/3, 1/3.2, 100);
			setInterval("slider.s1.run();", 16);
		}
	}
}();

function getPatchPixel(){
    if (navigator.appName == 'Microsoft Internet Explorer') {
        return -1;
    } else {
        if (navigator.userAgent.toLowerCase().indexOf('firefox') > 0) {
            return 1;
        } else if (navigator.userAgent.toLowerCase().indexOf('chrome') > 0) { 
            return 0;
        }
    }
    return 0;
}
function setPos(){
		try {
	
            document.getElementById("logo").style.position = "absolute"; 
            document.getElementById("logo").style.left = findPosX(document.getElementById("sliderImage1"))+"px"; 
            /*document.getElementById("roundcorner").style.position = "absolute"; 
            document.getElementById("roundcorner").style.left = (findPosX(document.getElementById("sliderImage1"))+getPatchPixel()+820-59)+"px";
            document.getElementById("roundcorner").style.top = findPosY(document.getElementById("sliderImage1"))+"px";
            document.getElementById("roundcorner").style.zIndex= 67779;*/

            document.getElementById("bar").style.position = "absolute"; 
            document.getElementById("bar").style.left = (findPosX(document.getElementById("sliderImage1"))+getPatchPixel())+"px";
            document.getElementById("bar").style.top = "445px";
            document.getElementById("bar").style.zIndex= 67777;
            
            document.getElementById("menu").style.position = "absolute"; 
            document.getElementById("menu").style.left = (findPosX(document.getElementById("sliderImage1"))+getPatchPixel())+"px";

            document.getElementById("menu").style.top = "455px";
            document.getElementById("menu").style.zIndex= 67778;
            
            }catch (e){
            }
}
 function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
  function random(num){
    return Math.floor(Math.random()*num+1);
    //return 0;
  }
  
  function gotoUrl(url){
  		window.open('http://'+location.host+'/'+url, '_self');
  }
/*
  function detectBrowser(){
    var ua = navigator.userAgent.toLowerCase();
    var binfo =
    {
        ve : ua.match(/.+(?:rv|it|fox|ie|ome)[\/: ]([\d.]+)/)[1],
        ie : /msie/.test(ua) && !/opera/.test(ua),
        op : /opera/.test(ua),
        sa : /version.*safari/.test(ua),
        ch : /chrome/.test(ua),
        ff : /gecko/.test(ua) && !/webkit/.test(ua)
    };
    if(binfo.ie){
        return "Internet Explorer " + binfo.ve;
    } else if(binfo.op){
        return "Opera "+ binfo.ve;
    } else if(binfo.sa){
        return "Safari "+(""+ua.match(/version.*safari/)).replace("version/","").replace("safari","")+ " ("+ binfo.ve+")";
    }else if(binfo.ch){
        return "Google Chrome "+ binfo.ve;
    }else if(binfo.ff){
        return "Mozilla Firefox "+ binfo.ve;
    } else {
        return "Unknown Internet Browser";
    }
}

function detectBrowser1(){
    var ua = navigator.userAgent.toLowerCase();
    var binfo =
    {
        ve : ua.match(/.+(?:rv|it|fox|ie|ome)[\/: ]([\d.]+)/)[1],
        ie : /msie/.test(ua) && !/opera/.test(ua),
        op : /opera/.test(ua),
        sa : /version.*safari/.test(ua),
        ch : /chrome/.test(ua),
        ff : /gecko/.test(ua) && !/webkit/.test(ua)
    };
    if(binfo.ie){
        if (parseInt(binfo.ve.charAt(0))>=7) 
        {return true; }
        else 
        {return false;}
    } else if(binfo.op){
        return false;
    } else if(binfo.sa){
        return true;
    }else if(binfo.ch){
        return true;
    }else if(binfo.ff){
        if (parseInt(binfo.ve.charAt(0))>=3) 
        {return true;}
        else 
        {return false;}
    } else {
        return false;
    }
}

function openWindow(url,w,h,ttlb,loc,tb,stb,l,mb,sb,rs,x,y){
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; //A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no'; ttlb=(ttlb)?'yes':'no';loc=(loc)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
//alert('location='+loc+',titlebar='+ttlb+',scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
var x=window.open(url, 'newWin'+new Date().getTime(), 'location='+loc+',titlebar='+ttlb+',scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}

function popmsg(){
openWindow("incompatible_browser.htm",260,140,0,0,0,0,0,0,0,0,0)
}*/

/*var oPopup = window.createPopup();
var popTop=50;
function popmsg(msgstr){
	winstr ="<table style='border: 1px solid #2574b3; font-family:Verdana; font-size:10px; color:#2574b3; padding:10px;' width='240' cellpadding='0' cellspacing='0' >";
    winstr+="<tr>";
    winstr+="<td>";
    winstr+="<img src='images/information.gif' alt=''/>&nbsp;&nbsp;";
    winstr+="You are using <b>"+msgstr+"</b>. This browser may not support all features of the site. To get better user experiences,";
    winstr+="we recommend you going to <a href='Recommended.aspx'>Recommended Browser</a> page to find the right Internet";
    winstr+="browser.</td>";
    winstr+="</tr>";
    winstr+="</table>";
	oPopup.document.body.innerHTML = winstr;
	popshow();
}
function popshow(){
	if(popTop>1720){
		clearTimeout(mytime);
		oPopup.hide();
		return;
	}else if(popTop>1520&&popTop<1720){
		oPopup.show(screen.width-250,screen.height,241,1720-popTop);
	}else if(popTop>1500&&popTop<1520){
		oPopup.show(screen.width-250,screen.height+(popTop-1720),241,172);
	}else if(popTop<180){
		oPopup.show(screen.width-250,screen.height,241,popTop);
	}else if(popTop<220){
		oPopup.show(screen.width-250,screen.height-popTop,241,172);
	}
	popTop+=10;
	var mytime=setTimeout("popshow();",50);
}
*/
