function toggleBroadcastHeadings(option) {
	if (option == 1) {
		document.getElementById('broadcast_headings').style.display='';
	}
	else {
		document.getElementById('broadcast_headings').style.display='none';
	}
}

function listen(url) {
	msgWindow=window.open(url,"ListenLive",
"toolbar=no,width=460,height=270,directories=no,status=no,scrollbars=auto,resize=1,menubar=no")	
}


function showStory(id,num) {
	if (document.getElementById('homenews_content_'+id).style.display == '') {
		document.getElementById('homenews_content_'+id).style.display='none';
		document.getElementById('homenews_title_'+id).style.fontWeight='';
		document.getElementById('homenews_link_'+id).style.color='';

	}
	else {
		document.getElementById('homenews_content_'+id).style.display='';
		document.getElementById('homenews_title_'+id).style.fontWeight='bold';
		document.getElementById('homenews_link_'+id).style.color='#000';
		i=1;
		while (i <= num) {
			if (i != id) {
				if (document.getElementById('homenews_content_'+i)) {
				document.getElementById('homenews_content_'+i).style.display='none';
				document.getElementById('homenews_title_'+i).style.fontWeight='';
				document.getElementById('homenews_link_'+i).style.color='';

				}
			}
			i=i+1;
		}
	}
}


// DYNAMIC POPUP //
function setOpacity( value ) {
 document.getElementById("contactbox").style.opacity = value / 10;
 document.getElementById("contactbox").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 6 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }

 setTimeout('closeMyPopup()', 800 );
}

function closeMyPopup() {
 document.getElementById("contactbox").style.display = "none"
}

function contactStudio() {
 setOpacity( 0 );
 document.getElementById("contactbox").style.display = "block";
 fadeInMyPopup();
}

function validate_required(field,alerttxt)
{
with (field)
{


if (field.id == "email")
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}

else {
	if (value==null||value=="")
  {alert(alerttxt);return false;}
	else {return true}
}

}
}

function validate(thisform)
{
with (thisform)
{
if (validate_required(name,"Please enter your name")==false)
  {name.focus();return false;}
else if (validate_required(email,"Please enter a valid email address")==false)
  {email.focus();return false;}
else if (validate_required(message,"Please enter a message")==false)
  {message.focus();return false;}
}
}

function checkfield(field)
{
	if (field.value==null||field.value=="")
	{
		var starid = field.id;
		document.getElementById("star_"+starid).style.display = "inline";
	}
	else
	{
		var starid = field.id;
		document.getElementById("star_"+starid).style.display = "none";
	}
}
function gFocus() {
	document.s.q.focus();
}

/////////////////////////
<!-- 
var state = 'none'; 

function showhide(layer_ref) { 

if (state == 'block') { 
state = 'none'; 
} 
else { 
state = 'block'; 
} 
if (document.all) { //IS IE 4 or 5 (or 6 beta) 
document.getElementById(layer_ref).style.display = state;
} 
if (document.layers) { //IS NETSCAPE 4 or below 
document.layers[layer_ref].display = state; 
} 
if (document.getElementById &&!document.all) { 
hza = document.getElementById(layer_ref); 
hza.style.display = state; 
} 
} 
//--> 

function viewItem(id) {
	msgWindow=window.open("items/view.php?item="+id,"ViewItem",
"toolbar=no,width=430,height=450,directories=no,status=no,scrollbars=auto,resize=1,menubar=no")	
}

function toggleShowContact() {
	var ShowContactBox = document.getElementById('showcontact');
	if (ShowContactBox.style.display == 'none') {
		ShowContactBox.style.display = '';
	}
	else {
		ShowContactBox.style.display = 'none';
	}
}