function refresh_page()
	{
	var reply=confirm("Refresh page to view updated credits?");
	if(reply==true)
		window.location = window.location;
	}

function bg_over(number)
	 {
	 if(document.getElementById("icon"+number))
		  document.getElementById("icon"+number).style.backgroundColor='#dededf';
	 if(document.getElementById("td_for_hide"+number))
		  document.getElementById("td_for_hide"+number).style.backgroundColor='#dededf';
	 if(document.getElementById("menu"+number))
		  document.getElementById("menu"+number).style.backgroundColor='#dededf';
	 }
function bg_out(number)
	 {
	 if(document.getElementById("icon"+number))
		  document.getElementById("icon"+number).style.backgroundColor='#FFFFFF';
	 if(document.getElementById("td_for_hide"+number))
		  document.getElementById("td_for_hide"+number).style.backgroundColor='#FFFFFF';
	 if(document.getElementById("menu"+number))
		  document.getElementById("menu"+number).style.backgroundColor='#FFFFFF';
	 }

function start_hide(menu_quantity,upon)
	 {
	menutimeout=setTimeout('fold_menu('+menu_quantity+','+upon+')',1000);
	 }

var tdwidth=178;
var increment=0;
menu_array=Array();

function fold_menu(menu_quantity,upon)
{
	if(tdwidth==178)
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			   menu_array[i]=document.getElementById("td_for_hide"+i).innerHTML;
			document.getElementById("td_for_hide"+i).innerHTML="&nbsp;";
			   }
		  }
	tdwidth-=8;
	increment+=8;
	if(tdwidth>23)
		  {
		document.getElementById("secNav").style.width=tdwidth+"px";
		  //alert(upon);
		  if(upon==0)
			   {
			   document.getElementById("content").style.width=546+increment+"px";
			   if(document.getElementById("tabs"))
					document.getElementById("tabs").style.width=588+increment+"px";
			   document.getElementById("border").style.width=578+increment+"px";
			   }
		  menutimeout=setTimeout('fold_menu('+menu_quantity+','+upon+')',6);
		  }
	else
		  {
		  //alert(tdwidth);
		clearTimeout(menutimeout);
		document.getElementById("fold_icons").innerHTML='<a href="#" onClick="unfold_menu('+menu_quantity+','+upon+');return false;"><img src="http://cdn.cellyspace.com/images/btnPlus.gif" border="0" width="12" height="12" alt="Expand menu" class="leftpad3" /></a>';
		  }
}

function unfold_menu(menu_quantity,upon)
{
	tdwidth+=8;
	increment-=8;
	//alert(tdwidth);
	if(tdwidth==178)
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			document.getElementById("td_for_hide"+i).style.display="";
			   }
		  }

	if(tdwidth<=178)
		  {
		document.getElementById("secNav").style.width=tdwidth+"px";
		  if(upon==0)
			   {
			   document.getElementById("content").style.width=546+increment+"px";
			   if(document.getElementById("tabs"))
					document.getElementById("tabs").style.width=588+increment+"px";
			   document.getElementById("border").style.width=578+increment+"px";
			   }
		  menutimeout1=setTimeout('unfold_menu('+menu_quantity+','+upon+')',5);
		  }
	else
		  {
		  //alert(tdwidth);

		for(i=0;i<menu_quantity;i++)
			   {
			document.getElementById("td_for_hide"+i).innerHTML=menu_array[i];
			   }

		clearTimeout(menutimeout1);
		document.getElementById("fold_icons").innerHTML='<a href="#" onClick="fold_menu('+menu_quantity+','+upon+');return false;"><img src="http://cdn.cellyspace.com/images/btnMinus.gif" border="0" width="12" height="12" alt="Hide menu" class="leftpad3" /></a>';
		  }
}
function jump(max,id)
	 {
	 var next=id+1;
	 if(document.getElementById("p_num_"+id).value.length==max)
		  document.getElementById("p_num_"+next).focus();
	 }



var td_flash_width=195;
menu_array_flash=Array();
function fold_menu_flash(menu_quantity)
	 {
	if(td_flash_width==195)
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			menu_array_flash[i]=document.getElementById("td_for_hide"+i).innerHTML;
			document.getElementById("td_for_hide"+i).innerHTML="&nbsp;";
			   }
		  }
	td_flash_width-=5;

	if(td_flash_width==30)
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			document.getElementById("td_for_hide"+i).style.display="none";
			   }

		document.getElementById("right_stripe").style.display="none";
		document.getElementById("right_stripe_grey").style.display="none";
		document.getElementById("bottom_line").style.display="none";
		document.getElementById("bottom_line2").style.display="none";
		  }

	if(td_flash_width>1)
		  {
		document.getElementById("leftmenu").style.width=td_flash_width+"px";
		document.getElementById("leftmenu_table").style.width=td_flash_width+"px";
		menutimeout=setTimeout('fold_menu_flash('+menu_quantity+')',5);
		  }
	else
		  {
		clearTimeout(menutimeout);
		document.getElementById("fold_icons").innerHTML='<a href="#" onClick="unfold_menu_flash('+menu_quantity+');return false;"><img src="http://cdn.cellyspace.com/images/plus.gif" border="0" width="12" height="12" /></a>';
		  }
	 }

function unfold_menu_flash(menu_quantity)
	 {
	if(td_flash_width==35)
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			document.getElementById("td_for_hide"+i).style.display="";
			document.getElementById("td_for_hide"+i).innerHTML="&nbsp;";
			   }
		document.getElementById("right_stripe").style.display="";
		document.getElementById("right_stripe_grey").style.display="";
		document.getElementById("bottom_line").style.display="";
		document.getElementById("bottom_line2").style.display="";
		  }
	td_flash_width+=5;
	if(td_flash_width<195)
		  {
		document.getElementById("leftmenu").style.width=td_flash_width+"px";
		document.getElementById("leftmenu_table").style.width=td_flash_width+"px";
		menutimeout1=setTimeout('unfold_menu_flash('+menu_quantity+')',5);
		  }
	else
		  {
		for(i=0;i<menu_quantity;i++)
			   {
			document.getElementById("td_for_hide"+i).innerHTML=menu_array_flash[i];
			   }
		clearTimeout(menutimeout1);
		document.getElementById("fold_icons").innerHTML='<a href="#" onClick="fold_menu_flash('+menu_quantity+');return false;"><img src="http://cdn.cellyspace.com/images/minus.gif" border="0" width="12" height="12" /></a>';
		  }
	 }

function start_hide_flash(menu_quantity)
	 {
	menutimeout=setTimeout('fold_menu_flash('+menu_quantity+')',1000);
	//clearTimeout(menutimeout);
	 }


	function stop_tooltips()
	{
	a=confirm('Are you sure that you don\'t want to see these tooltips anymore? \nYou\'ll be able to change this option in your profile.');
	if(a==true)
	{
	document.getElementById("tooltips").style.height="0px";
	tooltip_show('-1','','');
	}
	return false;
	}
	
	function hide_tooltips()
	{
	document.getElementById("tooltips").style.display="none";
	tooltip_show('-2','','');
	return false;
	}
	
	
	function tooltip_show(id_tooltip,array_sequence,id_page)
	{
	if (window.XMLHttpRequest) { // Mozilla, Safari, etc.
	request1 = new XMLHttpRequest();
	if (request1.overrideMimeType){
	request1.overrideMimeType('text/xml');
	}
	} else if (window.ActiveXObject) { // IE
	try {
	request1 = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	request1 = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {
	
	}
	}
	}
	var tooltipurl='tooltips_ajax_include.php?id_tooltip='+id_tooltip+'&array_sequence='+array_sequence+"&id_page="+id_page+'&rand='+Math.random();
	request1.onreadystatechange = dataTooltipReceived;
	request1.open('GET', tooltipurl, true);
	request1.send(null);
	}
	function dataTooltipReceived() {
	 //document.getElementById("greeting").style.display="none";
	document.getElementById("tooltips").innerHTML = "<p align='center' style='vertical-align: middle;'><table height='100%' width='100%' border=0 align='center'><tr><td height='100%' width='100%'  align='center'><img src='http://cdn.cellyspace.com/images/loading.gif' width='30' height='30' /></td></tr></table></p>" ;
	//alert(request.readyState);
	if((request1.readyState == 4) && (request1.status == 200)) {
	a = request1.responseText;
	//alert(a);
	document.getElementById("tooltips").innerHTML = a;

	}
	}
	
	var h=0;
	function expand(id_page)
	{
	h+=14;
	if(h<96)
		{
			document.getElementById("tooltips").style.height=h+"px";
			k=setTimeout('expand('+id_page+')',25);
		}
	else
		{
		tooltip_show('','',id_page);
		document.getElementById("show").innerHTML='<a class="toRight" onClick="hide('+id_page+'); return false;" href="#">Hide</a>';
		clearTimeout(k);
		}
	}
	
	function hide(id_page)
	{
	document.getElementById("tooltips").innerHTML='';
	h-=14;
	if(h>=0)
		{
			document.getElementById("tooltips").style.height=h+"px";
			k=setTimeout('hide('+id_page+')',25);
		}
	else
		{
		 //document.getElementById("greeting").style.display="";
		document.getElementById("show").innerHTML='<a class="toRight" onClick="expand('+id_page+'); return false;" href="#">Tips</a>';
		clearTimeout(k);
		}
	}


/* Rich Tips - So here you define the text, the divID/spanID of the content, and the divID/SpanID of where the hide button goes.
you can have multiple expand/collapse on each page. also define height dynamically */ 



	var m=0;
	var ele='';
	var hde='';
	var ht='';
	var txt='';
	var ele2='';
	var hde2='';
	
	function enlarge(api_text,target_element,target_hide,target_height)
	{
	m+=14;
	txt=api_text;
	ele=target_element;
	hde=target_hide;
	ht=target_height;

	if(m<ht)
		{
			document.getElementById(ele).style.height=m+"px";
			k=setTimeout('enlarge(txt,ele,hde,ht)',25);
		}
	else
		{
		document.getElementById(ele).innerHTML = txt;
		document.getElementById(hde).style.display='';
		clearTimeout(k);
		//m=0;
		}
	}
	
	function contract(target_element)
	{
	m-=14;
	el='api'+target_element;
	el_number=target_element;
	document.getElementById(el).innerHTML='';
	//document.getElementById(target_hide).innerHTML='';

	if(m>=0)
		{
			//alert( document.getElementById(hde2).style.height );
			document.getElementById(el).style.height=m+"px";
			k=setTimeout('contract(el_number)',25);
		}
	else
		{
		document.getElementById('show'+target_element).style.display='none';
		clearTimeout(k);
		}
	}










var color1='bg_wht';// ffffff
var color2='bg_whtlt';// f2f2f2
var color3='bg_hl';// CCCCCC
var color4='bg_sl';// 999999


function tr_highlight(id)
{
//alert(id);
current_color=document.getElementById("tr_"+id).className;
if(current_color==color1 || current_color==color2 || current_color=='')
  document.getElementById("tr_"+id).className=color3;
}
function tr_highlight_out(id)
{
if(id%2==0)
  color=color2;
else
  color=color1;

current_color=document.getElementById("tr_"+id).className;
//alert(current_color);
if(current_color==color3)
  document.getElementById("tr_"+id).className=color;
}
