
// collapse/expand

imgout=new Image(11,9);
imgin=new Image(11,9);

imgout.src="/pic/desc.gif";
imgin.src="/pic/asc.gif";

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}

//show OR hide funtion depends on if element is shown or hidden
function shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			filter(("img"+id),'imgin');			
		} else {
			filter(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				filter(("img"+id),'imgin');
			} else {
				filter(("img"+id),'imgout');	
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}

function showhide(id) { 
	if (document.getElementById(id).style.display == 'none')
	{
		document.getElementById(id).style.display = 'block';
	} 
	else 
	{
		document.getElementById(id).style.display = 'none';			
 	}	

}

function changerow(rowid, chkid, color)
{
	if(document.getElementById(chkid).checked)
		document.getElementById(rowid).style.backgroundColor=color;
	else
		document.getElementById(rowid).style.backgroundColor='';
}

function changeallrows(tableid, chkid, color)
{
	var table = document.getElementById(tableid);
	var rows = table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
	for (i = 0; i < rows.length - 1; i++) {
		if(document.getElementById(chkid).checked)
			rows[i].style.backgroundColor=color;
		else
			rows[i].style.backgroundColor='';
	}
}
//cookie

function getValue(cookie_name) {
if(document.cookie)
{
index = document.cookie.indexOf(cookie_name);
if (index != -1)
{
namestart = (document.cookie.indexOf("=", index) + 1);
nameend = document.cookie.indexOf(";", index);
if (nameend == -1) {nameend = document.cookie.length;}
cookie_value = document.cookie.substring(namestart, nameend);
return cookie_value;
}
}
}


function putCookie(cookie_name) {

is_expanded = getValue(cookie_name);

if ((is_expanded == 1) || !is_expanded)
{
	is_expanded = 0;
} else {
	is_expanded = 1;
}


document.cookie=cookie_name+"="+is_expanded+"; expires=Monday, 04-Apr-2010 05:00:00 GMT";

}

function addsmilie(smile,form,text){
    document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" ";
    document.forms[form].elements[text].focus(document.forms[form].elements[text].length);
}
function moresmilies(form,name) {
         link='smilies.php?form='+form+'&text='+name
         newWin=window.open(link,'moresmile','height=500,width=530,resizable=no,scrollbars=yes');
         if (window.focus) {newWin.focus()}

}



