function displayAjax(myid)
{
	tooltip("one","",myid);
	return false;
}
function HideAjax()
{	
	exittoolarea(1250);
}

function gotoSearch(searchMode,frmObj)
{
	if (searchMode == "webSearch"){		
			if (document.forms[0].query.value=='' || document.forms[0].query.value=='Search the Web...'){
				window.location.href = "web_index.php?tab=yw";
				return false;
			}else{	
				if (document.localSearch) { document.forms[0].localValue.value=document.localSearch.UserCity.value; }
				document.forms[0].submit();
			}
	}else if (searchMode == "dir"){
			if (document.forms[0].query.value=='' || document.forms[0].query.value=='Search the Directory...'){
				window.location.href = "<?=ROOT_PATH1?>directory";
				return false;
			}else{
				//if (frmObj){
					//frmObj.localValue.value=document.getElementById("UserCity").value;
				//alert(document.forms[0].localValue.value );
				//frmObj.submit();	
				//}else{
				//document.forms[0].localValue.value=document.getElementById("UserCity").value;
				if (document.localSearch) { document.forms[0].localValue.value=document.localSearch.UserCity.value; }
				//alert(document.forms[0].localValue.value );
				document.forms[0].submit();	
				//}
			}
	}else if (searchMode == "news"){
				if (document.forms[0].query.value=='' || document.forms[0].query.value=='Search the News...'){

					window.location.href = "<?=ROOT_PATH1?>news_category_result.php?catId=topStory&catType=topStory&tab=yn";
					return false;
				}else{
						document.forms[0].submit();
				}
	}else if (searchMode == "brok"){
				if (document.frmSearch.query.value=='' || document.frmSearch.query.value=='Search the Brokerage...'){
					window.location.href = "<?=ROOT_PATH1?>brokerage_search_result.php?tab=yb&reset=true&searchFrom=topHeader";
					return false;
				}else{
						document.frmSearch.submit();
				}
	}else if (searchMode == "job"){
			if (document.forms[0].textfield.value=='' || document.forms[0].textfield.value=='Search the Jobs...'|| document.forms[0].textfield.value=='Search the Resumes...'){
				window.location.href = "<?=ROOT_PATH1?>jobs";
				return false;
			}else{
					document.forms[0].submit();
			}
	}else if (searchMode == "img"){
			if (document.forms[0].query.value=='' || document.forms[0].query.value=='Search the Images...'){
				window.location.href = "<?=ROOT_PATH1?>image_search_result.php?tab=yi&imageMode=user";
				return false;
			}else{
					document.forms[0].submit();
				}

	}
}

function gotoSearch2(searchMode,frmObj)
{
	if ( searchMode == "img" )
	{
			if (document.forms[1].query.value=='' || document.forms[1].query.value=='Search the Images...')
			{
				window.location.href = "<?=ROOT_PATH1?>image_search_result.php?tab=yi&imageMode=user";
				return false;
			}
			else
			{
				document.forms[1].submit();
			}
	}
}

function detectEnterKey(e)
{
	/*		Comments by sandeep: 10-11-2009 because we have now button, before it was based on entery key
	var keynum;		
	if (window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if (e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	if (keynum == 13)
	{
		
		return true;	
	}		
	else
	{
		return false;
	} */
	return true;
}
function getpage(searchMode,e)
{
	
		enter_val = detectEnterKey(e);					
		if (enter_val === true)
		{
		
		if (document.forms[0].query.value == ''){
		/*if (searchMode == "webSearch")
		window.location.href = "index.php?tab=yw";
		else
		window.location.href = "index.php?tab=yd";
		*/
		return false;
		}else{
			gotoSearch(searchMode);
			}
		}
}

function goTo(path)
{
	try
	{
		location.href=path;
	}
	catch(e)
	{}
}

function getpage11(searchMode,e)
{
	enter_val = detectEnterKey(e);	
	//alert(enter_val);
	//alert(document.forms[0].query.value);
	//return false;					
		if (enter_val === true)
		{
		
		if (document.forms[0].query.value == ''){		
		return false;
		}else{
			if (document.forms[0].query.value=='Search the Directory...'){
				pr = document.forms[0].pr.value;
				categoryId = document.forms[0].categoryId.value;
				categoryStr = document.forms[0].categoryStr.value;
				localValue = document.localSearch.UserCity.value;
				//alert(categoryStr);
goTo('<?=ROOT_PATH1?>directory_home_results.php?pr='+pr+'&localValue='+localValue+'&categoryId='+categoryId+'&categoryStr='+categoryStr);
return false;
			}
			document.forms[0].localValue.value=document.localSearch.UserCity.value;
			//alert(document.forms[0].name);
			//alert(document.forms[0].localValue.value);

			document.forms[0].submit();
			//gotoSearch(searchMode,frmObj);
			return false;
			}
		}
}
function detectEnterKey2(e)
{	
	if (window.event) 
	{
		keynum = e.keyCode;
	}
	else if (e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	if (keynum == 13)
	{		
		return true;	
	}		
	else
	{
		return false;
	} 
	return true;
}
function getpageUserImages(searchMode,e,frmObj)
{	
	enter_val = detectEnterKey2(e);	
	var localValue = frmObj.userName.value;
	if (enter_val === true)
	{			
		goTo('<?=ROOT_PATH1?>image_search_result.php?tab=yi&imageMode=user'+'&localValue='+localValue);	
		return false;
	}
}
function getpageUserImages2(searchMode,e,frmObj)
{
	enter_val = detectEnterKey(e);	
	var localValue = frmObj.userName.value;
		
		goTo('<?=ROOT_PATH1?>image_search_result.php?tab=yi&imageMode=user'+'&localValue='+localValue);	
		return false;
	
}
	
	
function gotoSearch(searchMode)
{
	//alert(document.forms[0].query.value);
	//alert(searchMode)
	if (searchMode == "dir"){
	if (document.forms[0].query.value==''){
//	window.location.href = "index.php?tab=yd";
	//document.getElementById("search_bg").className="search_box3";
	return false;
	}else{
	//document.forms[0].action = "directory_home_results.php";
	//document.forms[0].pr.value = "<?=$config['dirSearchProfileName']?>";
	document.forms[0].submit();
	}
	}	
}
function setFocusSearch()
{
	document.forms[1].query.focus();
}

function changeImg(id,img)
{
	try
	{		
		document.getElementById(id).src=img;
	}
	catch(e)
	{}
}

function setImg(id,img)
{
	try
	{		
		document.getElementById(id).src= '<?=IMAGE_MAIN_PATH1?>images/menus/'+img;		
	}
	catch(e)
	{}
}

function inDefText(object)
{
	try
	{
		x=eval('document.forms[0].'+object);	
		if (x.value=='Search..') { x.value=''; }
	}
	catch(e)
	{		
	}	
}

function outDefText(object)
{
	
	try
	{
		x=eval('document.forms[0].'+object);	
		x.value=x.value.replace(/^([ ]+)$/,''); //remove blank spaces
		if (x.value=='') { x.value='Search..'; }
	}
	catch(e)
	{		
	}	
}

function checkKey(e)
{
	try
	{
		// IE 
		if (window.event) { keynum = e.keyCode; }
		else if (e.which) { keynum = e.which; }
		// Netscape/Firefox/Opera		
		if (keynum == 13) 
		{
			var x=eval('document.forms[0].textfield.value');
			x=x.replace(/^([ ]+)$/,''); //remove blank spaces
			try	{ document.forms[0].startIndex.value=0; } 
			catch(eee) { }
			if (x != '')
			{				
				document.forms[0].submit();
				return true;
			}
			else
			{
			return false;
			}
		}
		else
		{
			return false;
		}
	}
	catch(ee)
	{
	}
}

function doSubmit()
{
	
	try
	{
		var x=eval('document.forms[0].textfield.value');
		x=x.replace(/^([ ]+)$/,''); //remove blank spaces		
		if (x != '')
		{
			//document.forms[0].action='<?=ROOT_PATH1?>web_search_result.php?pr=webMetaSearch&query='+x;
			return true;
		}
		else 
		{
			document.forms[0].textfield.value='';
			alert('Please enter your search criteria !');
			return false;
		}
	}
	catch(e) { alert('Oops ! Sorry we are not able to process your request.\n Please try reloading the page.'); return false; }
	
}

function adjustTextBoxFocus(obj,mode){
		switch(mode){
			case"web":
				if (obj.value == 'Search the Web...'){
					obj.value='';
					//obj.className='srchboxfocus';
					obj.className='srch_box_bg_new';
				}
			break;

			case"dir":
				if (obj.value == 'Search the Directory...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;

				case"news":
				if (obj.value == 'Search the News...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;
			
			case"brok":
				if (obj.value == 'Search the Brokerage...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;

			case"job":
				if (obj.value == 'Search the Jobs...' || obj.value == 'Search the Resumes...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;
			
			case"img":
				if (obj.value == 'Search the Images...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;
		
		case"video":
				if (obj.value == 'Search the Videos...'){
					obj.value='';
					obj.className='srch_box_bg_new';
				}
			break;


		}
}

function adjustTextBoxBlur(obj,mode,searchMode){
		switch(mode){
			case"web":
				if (obj.value == ''){
					obj.value='Search the Web...';
					obj.className='srch_box_bg_new';
				}
			break;

			case"dir":
				if (obj.value == ''){
					obj.value='Search the Directory...';
					obj.className='srch_box_bg_new';
				}
			break;

			case"news":
				if (obj.value == ''){
					obj.value='Search the News...';
					obj.className='srch_box_bg_new';
				}
			break;
			
			case"brok":
				if (obj.value == ''){
					obj.value='Search the Brokerage...';
					obj.className='srch_box_bg_new';
				}
			break;

			case"job":
				if (obj.value == '')
				{
					if (searchMode=='resume')
					{
						obj.value='Search the Resumes...';
					}
					else
					{
						obj.value='Search the Jobs...';
					}
					obj.className='srch_box_bg_new';
				}
			break;
			
			case"img":
				if (obj.value == '')
				{
					obj.value='Search the Images...';
					obj.className='srch_box_bg_new';
				}
			break;
			case"video":
				if (obj.value == '')
				{
					obj.value='Search the Videos...';
					obj.className='srch_box_bg_new';
				}
			break;
		}
}
