// JavaScript Document

if (navigator.userAgent.indexOf('Opera') != -1 ) {
document.write('<link rel="stylesheet" type="text/css" href="/css/operahack.css">');
}

if (navigator.userAgent.indexOf("Safari") != -1) {
document.write('<link rel="stylesheet" type="text/css" href="/css/safarihack.css">');
}




var myTime=new Array();
var zi=100;


function menuShow(myNiv2){
	clearTimeout(myTime[myNiv2]);
  zi++;
  document.getElementById(myNiv2).parentNode.style.zIndex=zi;
	document.getElementById(myNiv2).style.display='block';    	
}

function menuHide(myNiv2){
	 Effect.Fade(myNiv2,{duration:0.2});
	//document.getElementById(myNiv2).style.display='none';	
}

function menuHideStart(myNiv2){
	myTime[myNiv2]=setTimeout('menuHide("'+myNiv2+'")',200);
}







function designShow(){
	clearTimeout(myTime[designCenter]);
	document.getElementById('designCenter').style.display='block';    	
}

function designHide(){
	 Effect.Fade('designCenter',{duration:0.2});
	//document.getElementById(myNiv2).style.display='none';	
}

function designHideStart(){
	myTime[designCenter]=setTimeout('designHide()',200);
}

function open_pdf(file) {
	window.open(file+".pdf","","");
}

function sub_vote(v_id,vote) {
	if (vote!=0) {
		var xscript=document.createElement("SCRIPT");
		xscript.src="/_includes/mods/eetimes/voter.php?v_id="+v_id+"&vote="+vote+"&scroll="+getTopPageScroll();;
		document.body.appendChild(xscript);
	} else {
		window.alert("Please make a choice !");
	}
}

var max_height=5000;
var s_height=1024;
var x_height=1024;

function repos_sky() {
	var s_top=0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		s_top=window.pageYOffset;
		s_height=window.innerHeight
	} else {
		s_top=document.documentElement.scrollTop;
		s_height=document.documentElement.clientHeight
	}

	x_height=(max_height-600);

	if (s_top>x_height) s_top=x_height;

	if (s_top>220) {
		$("skyscraper").style.top=(s_top+20)+"px";
	} else {
		$("skyscraper").style.top="220px";
	}
}

window.onscroll=function() { repos_sky() }

function change_max_height() {
	max_height=$("copyright").offsetTop;

}

StkFunc(change_max_height);


function switcher(direction){

  if (direction=='left'){
         $('accTop').style.backgroundImage='url(/design/tabs-left.gif)';
         $('aacLeft').style.color='#E88009';
         $('aacRight').style.color='#a4a4a4';   
         $('tab2').style.display='none'; 
         $('tab1').style.display='block';    
  }else{
         $('accTop').style.backgroundImage='url(/design/tabs-right.gif)';
         $('aacRight').style.color='#E88009'; 
         $('aacLeft').style.color='#a4a4a4'; 
         $('tab1').style.display='none';
         $('tab2').style.display='block';      
  }
}

function paginate_news() {	
	if (document.getElementById("news_main_content")) {
		CSBfleXcroll("news_main_content");
	}

}

StkFunc(paginate_news);



var magAlt = 3;

function magazine(){

    if(magAlt<=2){
                
        if (magAlt==1){
            document.getElementById('subs').style.display='block'; 
            document.getElementById('subscribe2Mag').style.backgroundPosition='0 0';
	           document.getElementById('subs').href='http://www.wdis.co.uk/webreg/CMP/ee-times-europe/page0.php'; 
             magAlt=4;	
        }else{
            document.getElementById('subs').style.display='block';
            document.getElementById('subscribe2Mag').style.backgroundPosition='0 -142px';
    	      document.getElementById('subs').href='http://www.electronics-eetimes.com/renew'; 
            magAlt=3;
        }
        
    }else{
    
        document.getElementById('subscribe2Mag').style.backgroundPosition='0 -284px';
	      document.getElementById('subs').style.display='none'; 
        
          if(magAlt==3){
            magAlt=1;
          }
          else{
            magAlt=2;
          }
        
    }
}

function changeMag() {
    var  timer=setInterval("magazine()", 3000);
}

StkFunc(changeMag);