//////////////////////////////////////////////////////////////////////////////////
// Page:
// ajax refrash file funcs
//
// Created: 1.09.2006
// By: Dotan  
//
// Last modified: 1.09.2006
// By: Dotan
//
// Status:OPEN
///////////////////////////////////////////////////////////////////////////////////



// function refreshPart
// refresh a specific file (include) witch as been loaded
// * in order to be used the refreshed file as to 
// include the header and footer files
// vars :
// file_name - the file name to refresh with (requsted file), called from the server.  (usualy the same file witch was origenly loaded in the place to be refreshed)
// vars - vars to be sent whn requsting 'file_name'.
// refrashID - the ID of the div witch the file is beeing refrashed in to.
// method - method of send. 'POST' or 'GET', default 'POST'
// onFinish - method to run wane the refresh finish

// * class "loadingMsg" is the css class of the "loading..." msg
function refreshPart(file_name,vars,refrashID,method,onFinish)
{
	var obj;
	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)return;

	xmlHttp.onreadystatechange=function()
	{
		var added=''
		obj=document.getElementById(refrashID);
		
		if(xmlHttp.readyState==4)
		{
			if(!obj)return;
			obj.innerHTML = xmlHttp.responseText;
			if(onFinish)eval(onFinish);
		}
		else 
		{
			var str='';
			for(i=0;i<xmlHttp.readyState;i++)
				str+='.';
			
			if(obj.offsetHeight)
				added='style="height:'+obj.offsetHeight+';width:'+obj.offsetWidth+'"';
			else added=''
			obj.innerHTML ='<div '+added+' class="loadingMsg" align="center">Loading'+str+'</div>';
		}
	}
	
	if(!method)method='POST';
	
	var vars_str='';
	
	if(document.forms[0])
	{
		if(document.forms[0].SiteName)
			vars_str+='SiteName='+document.forms[0].SiteName.value;
		if(document.forms[0].Clubtmp1)
			vars_str+='&Clubtmp1='+document.forms[0].Clubtmp1.value;
		if(document.forms[0].NewNameMade)
			vars_str+='&NewNameMade='+document.forms[0].NewNameMade.value;
	}
	
	vars_str+='&isRefrash_'+refrashID+'=1';
	
	if(vars)
	{
		encodeURI(vars);
		vars_str+='&'+vars;
	}
	
	if(method=='POST')
	{
		xmlHttp.open('POST',file_name,true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length",vars_str.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(vars_str);
	}
	else
	{
		file_name+='?'+vars_str;
		xmlHttp.open("GET",file_name,true);
		xmlHttp.send(null);
	}
}

function display_main_search()
{
	display_divs(new Array('CellNum16','CellNum18'),'none')
}



function display_divs(divs,displayValue)
{
	var obj=null;
	for(i=0;i<divs.length;i++)
	{
		obj=document.getElementById(divs[i]);
		if(!obj)continue;
		obj.style.display=displayValue;
	}
}
