// JavaScript Document

var main_cat = 0;
var curr_cat = 0;
function setMainCat(cat){
	setSearchButton();
	main_cat = cat;
}
function openPages(cat){
	curr_cat = cat;
	var sub_cat = document.getElementById("sub_container_"+cat);
	sub_cat.style.display = (sub_cat.className != 'sub_container noclose' && sub_cat.style.display == "block" && curr_cat != main_cat) ? "none" : "block";
	
	if(sub_cat.className != 'sub_container noclose' && curr_cat != main_cat){
		document.getElementById("category_title_"+cat).className = (sub_cat.style.display == "block") ? "open_category_title" : "category_title";
	}

}

function openCategories(cat){
	if(cat > 0 && document.getElementById("category_title_"+cat)){
		document.getElementById("category_title_"+cat).className = "open_category_title";
		cont = document.getElementById("sub_container_"+cat);
		cont.style.display = "block";
		if(cont.parentNode.parentNode.className == 'sub_container'){
			cont.parentNode.parentNode.className += ' noclose';
			openCategories(cont.parentNode.parentNode.id.replace(/sub_container_/,''));
		}
	}
}

function sendToFriend(){
  var sendWindow = window.open('scripts/sendToFriend.php?url='+window.location,'','width=500,height=300,scrollbars=no');
}

function setTopMenu(id){
	setSearchButton();
	if(document.getElementById(id)) document.getElementById(id).className = "top_menu_active";
}

function setSearchButton(){ 
	if(document.getElementById("search_button")){
		document.getElementById("search_button").onmouseover = function(){
			document.getElementById("search_idle").style.display = 'none'
			document.getElementById("search_rollover").style.display = 'inline'
		}
		document.getElementById("search_button").onmouseout = function(){
			document.getElementById("search_rollover").style.display = 'none'
			document.getElementById("search_idle").style.display = 'inline'
		}
		document.getElementById("search_button").onclick = function(){
														var form = document.getElementById("search_form");
														var trimmedText = form.text.value.replace(/^\s+|\s+$/g,"");
														if(trimmedText != "") form.submit();
													};
	}
}

function validateSearchForm(){ 
	
}

function addToFavorites(pageName){ 
	var urlAddress = window.location;
	try{
		window.external.AddFavorite(urlAddress, pageName) 
	}
	catch(exception){ 
		alert("Sorry! Your browser doesn't support this function."); 
	}
}


/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


