
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}



function switchBack(id) {
	new_back = '/resources/back_icon'+id+'.jpg';
	new_call = 'call'+id;
	
	for (i = 1; i < 5; i++) {
		old_call = 'call'+i;
		document.getElementById(old_call).style.visibility = 'hidden';
		//document.getElementById(old_call).style.zIndex = -1;
	}

	document.getElementById('main_imag').style.backgroundImage = 'url('+new_back+')'; 
	document.getElementById(new_call).style.visibility = 'visible';
	//document.getElementById(new_call).style.zIndex = 1;
	
}

var count 		= 1;
var total 		= 4;
var interval 	= 6000;

function autoRotate(){
	if(count == total) {
		count = 1;
	} else {
		count = count + 1;
	}
	resetIcons(count);
	switchBack(count);
}

function resetIcons(count){
	for(i=1; i<5; i++) {
		if(count == i) {
			rollover = '_f2';
		} else {
			rollover = '';
		}
		
		MM_swapImage('icon'+i,'','/resources/icon'+i+rollover+'.gif',1);
	}
}

function startRotation () {
	rotation = setInterval("autoRotate()", interval);
}

    $(document).ready(function() { 
        $('ul.sf-menu').superfish({ 
            delay:       500,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: true                            // disable drop shadows 
        }); 
    }); 
 
 function windowShade(divLoc, wdth, hght, vsblty) {
	document.getElementById(divLoc).style.width = wdth;
    document.getElementById(divLoc).style.height = hght;
   	document.getElementById(divLoc).style.visibility = vsblty;
}

function openProduct(id, nmbr, wdth, hght, vsblty) {
	var v = document.getElementById(id + nmbr).style.visibility;
	for(i=1; i<21; i++) {
		divLoc = id + i;
		windowShade(divLoc, "", 0, "hidden");
		solu_task = "solu_task" + i;
		document.getElementById(solu_task).setAttribute('class', 'solu_task_text');
		
	}
		
	if(v == 'hidden') {
		divLoc = id + nmbr;
		windowShade(divLoc, "", "", "visible");
		solu_task = "solu_task" + nmbr;
		document.getElementById(solu_task).setAttribute('class', 'solu_task_text_open');
	} 
}


function chooseState(stateid) {

    showStuff('templates/Default.aspx?submit=setstate&stateid=' + stateid, 'stat_cont', '', '245px', '232px', 'visible');
		windowShade('stat_drop', '245px', '0px', 'hidden');
		windowShade('stat_butt', '236px', '24px', 'visible');
	
}

