var handle;
window.onload = function() 
{ 
	
	handle = window.setInterval(replaceButton, 1);
}
function replaceButton()
{
	var objs = getElementsByClass("gsc-search-button");
	if(objs.length > 0)
	{
		for(var i = 0; i < objs.length; i++)
		{
			if(objs[i].tagName == "INPUT")
			{			
				window.clearInterval(handle);
				
				try
				{
					objs[i].setAttribute("type","image");
					objs[i].setAttribute("src","images/search_button.gif");
				}
				catch(e)
				{
					var parent = objs[i].parentNode;
					parent.removeChild(objs[i]);
					var input = document.createElement("INPUT");
					input.setAttribute("type","image");
					input.setAttribute("src","images/search_button.gif");
					input.setAttribute("class","gsc-search-button");
					input.setAttribute("value","Search");
					input.setAttribute("title","search");
					parent.appendChild(input);
				}
								
								
			}
		}
	}
}




function rollover(img,on)
{		  
	off = img.src;
	offfull = img.src;
	onfull = on;
	path = off.substring(0,off.lastIndexOf('/')+1); 
	onfull = path + onfull;
	//alert(onfull);
	if(off.lastIndexOf('/') != -1) // if there is a path, strip it
		{
			 off = off.substring(off.lastIndexOf('/')+1);
		}
	if(on.lastIndexOf('/') != -1) // if there is a path, strip it
		{
			 on = on.substring(on.lastIndexOf('/')+1);
		}
	if(on != off)
		{		  
      off_ex = off.substring(off.lastIndexOf('.')) // extract extension     
			off = off.substring(0,off.lastIndexOf('.')); //strip extension	       		
      on_ex = on.substring(on.lastIndexOf('.')) // extract extension     
			on = on.substring(0,on.lastIndexOf('.')); //strip extension			      		
			eval(off + " = new Image(); ");						 
			eval(off + ".src = '" + offfull +"'");			
			eval(on + " = new Image(); ");			
			eval(on + ".src = '" + onfull +"'");
			var image_on = eval(on + ".src");
			var image_off = eval(off + ".src");
			img.onmouseover = function() { img.src = image_on;}
			img.onmouseout = function() { img.src = image_off;}
		}
}


function expand(divID){
	img = document.getElementById("expand_" + divID);
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID);
	box.style.display = box.style.display != "block" ? "block" : "none";
	
}

function compare_expand(divID){
	img = document.getElementById("expand_" + divID + "1");
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "images/plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID + "1");
	box.style.display = box.style.display == "none" ? "block" : "none";
	
	img = document.getElementById("expand_" + divID + "2");
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "images/plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID + "2");
	box.style.display = box.style.display == "none" ? "block" : "none";
	
	img = document.getElementById("expand_" + divID + "3");
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "images/plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID + "3");
	box.style.display = box.style.display == "none" ? "block" : "none";
	
	img = document.getElementById("expand_" + divID + "4");
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "images/plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID + "4");
	box.style.display = box.style.display == "none" ? "block" : "none";
}
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function expand2(divID){
	img = document.getElementById("expand_" + divID);
	img.src = img.src.substr(img.src.lastIndexOf("/")+1) == "images/plus_gray.gif" ? "images/minus_blue.gif" : "images/plus_gray.gif";
	box = document.getElementById(divID);
	box.style.display = box.style.display != "block" ? "block" : "none";
			//document.getElementById('content_container').style.height = document.getElementById('s_main_content').offsetHeight + "px";
}
        
