// Make calls to other operations from this file. 


// fired at the end of the page once all html has loaded
function onDOMload () {
	if(typeof sIFR == "function"){
		switchFonts();
	};
	if(typeof buildTransitions == "function") {
		buildTransitions();
	};
	
};

// fired once all content has loaded
function onPageLoad () {
	
};



document.onload = onPageLoad();

function printPage () {
	window.print();
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



function openDir( form ) { 

	var newIndex = form.sort.selectedIndex; 

	if ( newIndex == 0 ) { 

		alert( "Please select a location!" ); 

	} else { 

		cururl = form.sort.options[ newIndex ].value; 

		window.location.assign( cururl ); 

	} 

}

function addListener(element, type, expression, bubbling)
{
bubbling = bubbling || false;
if(window.addEventListener) { // Standard
element.addEventListener(type, expression, bubbling);
return true;
} else if(window.attachEvent) { // IE
element.attachEvent('on' + type, expression);
return true;
} else return false;
}

/*image rotator*/
function start_image_rotator(){
	rcount = 0;
	rimg.src='/image-rotator/'+r[rcount].img;
	rlink.href=r[rcount].url;
	myinterval=setInterval('next_image()',seconds*1000,false);
	addListener(rimg, "mouseover", function(){clearInterval(myinterval); myinterval='stopped'; } );
	addListener(rimg, "mouseout", function(){ if (myinterval=='stopped'){myinterval = setInterval('next_image()',seconds*1000,false)} });
	
}

function next_image(){
	rcount++;
	if (rcount==r.length){rcount=0;}
	rimg.src='/image-rotator/'+r[rcount].img;
	rlink.href=r[rcount].url;
}