
extraOnPageLoad = "";

function sharathon(){

	thisyear = new Date();

	thisyear = thisyear.getFullYear();

	Shadowbox.open({title: 'Sharathon '+thisyear, type: 'iframe', content: '/sharathon/', height: 500, width: 700});

}


function convert_links_to_redirect(){

	atags = document.getElementsByTagName('a');

	for(i=0; i<atags.length; i++){

		atarget = atags[i].getAttribute('target');
		ahref = atags[i].getAttribute('href');


		if(atarget == '_blank' && ahref.match(/^http:\/\//) && !ahref.match(/^http:\/\/(www\.)?thyword(network)?\.org/)){

			atags[i].setAttribute('href','/redirect/'+ahref);

		}

	}


}


var myimages=new Array()
		function preloadimages(){
		for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image();
		myimages[i].src=preloadimages.arguments[i];
		}
		}


		preloadimages('/img/logo_o.jpg', '/img/menu1_o.png', '/img/menu2_o.png', '/img/menu3_o.png', '/img/menu4_o.png', '/img/menu5_o.png', '/img/menu6_o.png', '/img/listen_online_o.jpg', '/img/view_playlist_o.jpg', '/img/loginform.png', '/img/thumbsupact.png', '/img/thumbsdownact.png', '/img/thumb-up-o.png', '/img/thumb-down-o.png', '/calendar/finder_o.png');




var slideNP_h = 0;
var slideWorking = 0;

function slideUpNP(){

	var slider;
	slider = document.getElementById("np_slide");


	slideNP_h = slideNP_h-6;

	if(slideNP_h < 1){ slideNP_h = 0; }

	slider.style.height = slideNP_h+'px';

	if(slideNP_h > 0){
		setTimeout(slideUpNP, 1);
	}
	else{
		slider.style.display='none';
		slideWorking = 0;
		document.getElementById('show_link').innerHTML = 'Show';
		ajax_innerHTML('slideframe', 'slide.php?function=hide');

	}

}

function slideDownNP(){

	var slider;
	slider = document.getElementById("np_slide");


	slideNP_h = slideNP_h+6;

	if(slideNP_h > 174){ slideNP_h = 175; }

	slider.style.height = slideNP_h+'px';

	if(slideNP_h < 175){
		setTimeout(slideDownNP, 1);
	}
	else{
		slideWorking = 0;
		document.getElementById('show_link').innerHTML = 'Hide';
		ajax_innerHTML('slideframe', 'slide.php?function=show');
	}


}


function slideNP(){

	var slider;
	slider = document.getElementById("np_slide");

	if(slideWorking == 0){


	if(slider.style.display == 'none'){

		//SLIDE DOWN

		slider.style.overflow = 'hidden';
		slider.style.height = '0px'
		slider.style.display = 'block';
		slideNP_h = 0;

		slideWorking = 1;

		slideDownNP();

	}
	else{

		// SLIDE UP

		slider.style.overflow = 'hidden';
		slider.style.height = '175px'
		slider.style.display = 'block';
		slideNP_h = 175;	

		slideWorking = 1;

		slideUpNP();

	}

	}


}


function noHTML(theterm){

	theterm = theterm.replace(/&/g, "and");
	theterm = theterm.replace(/</g, "&lt;");
	theterm = theterm.replace(/>/g, "&gt;");
	theterm = theterm.replace(/"/g, '&quot;');
	termterm = theterm.replace(/'/g, "&#39;");

	return theterm;

}

function cbd_sku(term){
	window.open("/cbd/sku/"+term, "CBD");
}
function cbd_search(term){
	window.open("/cbd/search/"+term, "CBD");
}


function findevent(eid){

		
		Shadowbox.open({title: 'Community Calendar Event', type: 'iframe', content: '/calendar/pop.php?id='+eid, height: 400, width: 500});

}

function dosearch(){

	var searchy = document.getElementById('spsearch');


	document.getElementById('bigsearch').style.display = 'block';

}

function show(ele){
	document.getElementById(ele).style.visibility = 'visible';
	document.getElementById(ele).style.display = 'block';
}

function hide(ele){
	document.getElementById(ele).style.display = 'none';
}

function toggle(ele){

	if(document.getElementById(ele).style.display == 'none'){
		show(ele);
	}
	else{
		hide(ele);
	}

}

function show_menu(menu_id){

	show('mm'+menu_id);
	document.getElementById("mi"+menu_id).src="/img/menu"+menu_id+"_o.png";

}


function hide_menu(menu_id){

	hide('mm'+menu_id);
	document.getElementById('mi'+menu_id).src="/img/menu"+menu_id+(twn_page_tab==menu_id ? "_o" : "")+".png";

}
