var rector=2;
var stopit=0 ;
var a=3;
var k = +!!-~+!+!"", e = -~!+~~"", y = -~-~+!!~+'';

function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}

function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector+"px"
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector+"px"
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector+"px"
}
else{
shake.style.left=parseInt(shake.style.left)-rector+"px"
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50);
}

function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}
function masterQuick(form){
var URL = document.quickSelect.site.options[document.form.quickSelect.selectedIndex].value;
var a = $('#master');
a.attr('src',URL+ '?'+Math.random()).fadeIn('fast');
}

function get_time_difference(earlierDate,laterDate)
{
       var nTotalDiff = laterDate.getTime() - earlierDate.getTime();
       var oDiff = new Object();
 
       oDiff.days = Math.floor(nTotalDiff/1000/60/60/24);
       nTotalDiff -= oDiff.days*1000*60*60*24;
 
       oDiff.hours = Math.floor(nTotalDiff/1000/60/60);
       nTotalDiff -= oDiff.hours*1000*60*60;
 
       oDiff.minutes = Math.floor(nTotalDiff/1000/60);
       nTotalDiff -= oDiff.minutes*1000*60;
 
       oDiff.seconds = Math.floor(nTotalDiff/1000);
 
       return oDiff;
       }

function quickPeek(){
	counts= 1.0;
    aTotal = 1.0;
    stopNormal = 1;
    var e = $("#timeCount");
    e.attr('value'," ");
	var index = document.quickSelect.site.selectedIndex;
	var a = $('#panel4_2');
	var URL = ""
	switch(index){
	       case 0 :break;
           case 1 :URL = "http://alicedcs.web.cern.ch/AliceDCS/monitoring/Screenshots/Panels/ACR-BS1-M.png";break;
           case 2 :URL = "http://alicedcs.web.cern.ch/AliceDCS/monitoring/Screenshots/Panels/ACR-BS2-XL.png";break;
           case 3 :URL = "http://alicedcs.web.cern.ch/AliceDCS/monitoring/Screenshots/Panels/ENV-Zones.png";break;
           case 4 :URL = "http://alicedcs.web.cern.ch/AliceDCS/monitoring/Screenshots/Panels/HMP-HAL9K.png";break;
           case 5 :URL = "http://alicedcs.web.cern.ch/AliceDCS/monitoring/Screenshots/Panels/MCS.png";break;
           case 6 :URL = "http://atlaseye-webpub.web.cern.ch/atlaseye-webpub/web-sites/pages/picts/web07.jpg";break;
           case 7 :URL = "http://atlaseye-webpub.web.cern.ch/atlaseye-webpub/web-sites/pages/picts/web08.jpg";break;
           case 8 :URL = "http://atlaseye-webpub.web.cern.ch/atlaseye-webpub/web-sites/pages/picts/web09.jpg";break;
           case 9 :URL = "http://atlaseye-webpub.web.cern.ch/atlaseye-webpub/web-sites/pages/picts/web12.jpg";break;
           case 10 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye10.jpg";break;
           case 11 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye4.jpg";break;
           case 12 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye5.jpg";break;
           case 13 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye6.jpg";break;
           case 14 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye7.jpg";break;
           case 15 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye8.jpg";break;
           case 16 :URL = "http://cmsinfo.web.cern.ch/cmsinfo/outreach/cmseye/eye9.jpg";break;
           case 17 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/aDAQmon.jpg";break;
           case 18 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/CPUusage.jpg";break;
           case 19 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/DAQstatusGre.jpg";break;
           case 20 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/FEDs.jpg";break;
           case 21 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/History.jpg";break;
           case 22 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/L1Scalers.jpg";break;
           case 23 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/Pie.jpg";break;
           case 24 :URL = "http://cmsonline.cern.ch/evtdisp/3DRecHit.png";break;
           case 25 :URL = "http://cmsonline.cern.ch/evtdisp/3DTower.png";break;
           case 26 :URL = "http://cmsonline.cern.ch/evtdisp/fireworks_hlt_p5.png";break;
           case 27 :URL = "http://cmsonline.cern.ch/evtdisp/Lego.png";break;
           case 28 :URL = "http://cmsonline.cern.ch/evtdisp/RhoPhi.png";break;
           case 29 :URL = "http://cmsonline.cern.ch/evtdisp/RhoZ.png";break;
           case 30 :URL = "http://cmspage1.web.cern.ch/cmspage1/data/page1.png";break;
           case 31 :URL = "http://lhcdashboard-images.web.cern.ch/lhcdashboard-images/images/lhc/prod/dashboard.png";break;
           case 32 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/ade.png";break;
           case 33 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/cps.png";break;
           case 34 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/ctf.png";break;
           case 35 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/gps.png";break;
           case 36 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/hrs.png";break;
           case 37 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/larger1.png";break;
           case 38 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/larger2.png";break;
           case 39 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/larger3.png";break;
           case 40 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/larger4.png";break;
           case 41 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/leir.png";break;
           case 42 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhc1.png";break;
           case 43 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhc2.png";break;
           case 44 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhc3.png";break;
           case 45 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/LHCBDS.png";break;
           case 46 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhccolli1.png";break;
           case 47 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhccolli2.png";break;
           case 48 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/LHCCONFIG.png";break;
           case 49 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhccoord.png";break;
           case 50 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhcexpmag.png";break;
           case 51 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhclumi.png";break;
           case 52 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lin.png";break;
           case 53 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/pea.png";break;
           case 54 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/psb.png";break;
           case 55 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/sps1.png";break;
           case 56 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/gps.png";break;
           case 57 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/psb.png";break;
           case 58 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhccolli1.png";break;
           case 59 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhccolli2.png";break;           
           case 60 :URL = "http://vistar-capture.web.cern.ch/vistar-capture/lhclumi.png";break;
           case 61 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/aDAQmon.jpg";break;
           case 62 :URL = "http://cmsonline.cern.ch/daqStatusSCX/aDAQmon/ALERTstatistics1.jpg";break;
           case 63 :URL = "http://cmsonline.cern.ch/evtdisp/3DTower.png";break;
           default:break;
}
  if(URL != ""){
	a.attr('src',URL+ '?'+Math.random()).fadeIn('fast');
	a.attr('title',' "'+getName(URL)+'" ');
	setTimeout('refreshNormal()',4000);
  }
};
function FullView(){
	counts= 1.0;
    aTotal = 1.0;
    var e = $("#timeCount");
    e.attr('value'," ");
	var index = document.fullSelect.site.selectedIndex;
	var URL = " "
	switch(index){
	       case 0 :break;
           case 1 :URL = "ACR-BS1-M.html"; break;
           case 2 :URL = "ACR-BS2-XL.html"; break;
           case 3 :URL = "ENV-Zones.html"; break;
           case 4 :URL = "HMP-HAL9K.html"; break;
           case 5 :URL = "MCS.html"; break;
           case 6 :URL = "web07.html"; break;
           case 7 :URL = "web08.html"; break;
           case 8 :URL = "web09.html"; break;
           case 9 :URL = "web12.html"; break;
           case 10 :URL = "eye10.html"; break;
           case 11 :URL = "eye4.html"; break;
           case 12 :URL = "eye5.html"; break;
           case 13 :URL = "eye6.html"; break;
           case 14 :URL = "eye7.html"; break;
           case 15 :URL = "eye8.html"; break;
           case 16 :URL = "eye9.html"; break;
           case 17 :URL = "aDAQmon.html"; break;
           case 18 :URL = "CPUusage.html"; break;
           case 19 :URL = "DAQstatusGre.html"; break;
           case 20 :URL = "FEDs.html"; break;
           case 21 :URL = "History.html"; break;
           case 22 :URL = "L1Scalers.html"; break;
           case 23 :URL = "Pie.html"; break;
           case 24 :URL = "3DRecHit.html"; break;
           case 25 :URL = "3DTower.html"; break;
           case 26 :URL = "fireworks_hlt_p5.html"; break;
           case 27 :URL = "Lego.html"; break;
           case 28 :URL = "RhoPhi.html"; break;
           case 29 :URL = "RhoZ.html"; break;
           case 30 :URL = "page1.html"; break;
           case 31 :URL = "dashboard.html"; break;
           case 32 :URL = "ade.html"; break;
           case 33 :URL = "cps.html"; break;
           case 34 :URL = "ctf.html"; break;
           case 35 :URL = "gps.html"; break;
           case 36 :URL = "hrs.html"; break;
           case 37 :URL = "larger1.html"; break;
           case 38 :URL = "larger2.html"; break;
           case 39 :URL = "larger3.html"; break;
           case 40 :URL = "larger4.html"; break;
           case 41 :URL = "leir.html"; break;
           case 42 :URL = "lhc1.html"; break;
           case 43 :URL = "lhc2.html"; break;
           case 44 :URL = "lhc3.html"; break;
           case 45 :URL = "LHCBDS.html"; break;
           case 46 :URL = "lhccolli1.html"; break;
           case 47 :URL = "lhccolli2.html"; break;
           case 48 :URL = "LHCCONFIG.html"; break;
           case 49 :URL = "lhccoord.html"; break;
           case 50 :URL = "lhcexpmag.html"; break;
           case 51 :URL = "lhclumi.html"; break;
           case 52 :URL = "lin.html"; break;
           case 53 :URL = "pea.html"; break;
           case 54 :URL = "psb.html"; break;
           case 55 :URL = "sps1.html"; break;
           case 56 :URL = "gps.html"; break;
           case 57 :URL = "psb.html"; break;
           case 58 :URL = "lhccolli1.html"; break;
           case 59 :URL = "lhccolli2.html"; break;           
           case 60 :URL = "lhclumi.html"; break;
           case 61 :URL = "aDAQmon.html"; break;
           case 62 :URL = "alertstatistics1.html"; break;
           case 63 :URL = "3DTower.html"; break;
           case 64 :URL = "alice1.html"; break;
           default:break;
}
  if(URL != " "){
    URL=URL.toLowerCase();
    window.open(URL);
    puMessOn();
    }
};

function puMessOn(){ 
    var p = document.getElementById('puMess');
    p.style.display = 'block';   
    setTimeout('puMessOff()',5000);
};

function puMessOff(){ 
    var p = document.getElementById('puMess');
    p.style.display = 'none';
	document.fullSelect.site.selectedIndex = 0;
};
