function toggleTextOut(e,txtval) {
	if(e.value=="") e.value = txtval;

}
function toggleTextIn(e,txtval) {
	if(e.value==txtval) e.value="";
	else e.select();
}



$( function () { 
	
	$('ul#clients-cat  li:first h5').removeClass('plus');
	$('ul#clients-cat  li:first h5').addClass('minus');
	$('ul#clients-cat  li:first h5').next('div').show('slow');
$('#clients-cat h5').click(function() {
		var cs=this.className;
		$('#clients-cat h5').next('div').hide('slow');
		$('#clients-cat h5').addClass('plus');
		$('#clients-cat h5').removeClass('minus');
	
		if(cs=="minus")
		{
			this.className="plus";
		}
		else{
			this.className="minus";
			$(this).next('div').show( "slow");}
		});
		menu_formater();
		
		});


function menu_formater(){
	$("#nav-top").find('li').each(function(){
		var flag = false;
		$(this).hover(function(){
				// over
				if($(this).next().attr('class') == 'current') {
					$(this).next('li').removeClass('next-menu current');
					$(this).next('li').addClass('next-menu current');
				}if($(this).attr('class') == 'next-menu') {
					$(this).removeClass('next-menu');
					$(this).addClass('prev-menu-current');
					$(this).next('li').addClass('next-menu');
					flag = true;
				} else {
					$(this).next('li').addClass('next-menu');
				}
				
			}, function(){
				// out
				if (flag) {
					$(this).addClass('next-menu');
					$(this).removeClass('prev-menu-current');
					$(this).next('li').removeClass('next-menu');
					flag = true;
				} else if($(this).attr('class') != 'current') {
					$(this).next('li').removeClass('next-menu');
				}
				
		});
		
		
		if($(this).attr('class') == 'current') {
				$(this).next().addClass('next-menu');
		}
		
		
		
	});
	
}

function trimAll(sString)
{
		while (sString.substring(0,1) == ' ')
		{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
	return sString;
}		
function searchboxValidate(){
	
	sb = document.getElementById('txtSearchBox').value;
	sb=trimAll(sb);
	if(sb=="Search here..." || sb==""){
	alert('Please enter a search query');
	document.getElementById('txtSearchBox').focus();
	return false;
	}
	return true;
}
		
//check for valid email		
function isValidEmail(str)
{
		filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		return(filter.test(str));
}	
function GetData(id)
{
	
	var content = document.getElementById(id);
	if(content == null)
		return("");
	return(content.innerHTML);
}
function Print(printPage, id, title)
{ 
	if(title == '')
		title = document.title;
	var url = printPage + "?id=" + id + "&title=" + title
	
	var p = window.open(url, '', "width=500, height=600, left=100, top=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, toolbar=no, fullscreen=no");
}
	
function PrintThisPage(id, printId)
{
		
	var content = document.getElementById(printId);

	if(content == null)
		return;
	if(window.opener == null)
		return;
	var html = window.opener.GetData(id);
	html = DisableHyperlinks(html);
	content.innerHTML = html;
	window.print();
}

function DisableHyperlinks(html)
{
	return(html.replace(/href\s*=\s*\"*[^\">]*"/ig,"href=\"#\""));
}

/* email specific functions */

function Email(url)
{
	url = url + "&page_title=" + document.title;
	var p = window.open(url,'Email', "width=405, height=415, left=200, top=200, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no, fullscreen=no");
	
}	