function addslashes(str) {
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str.replace(/\n/g,"<br>");
}

function __display_advanced_search()
{
	var oForm = document.forms['searchForm'];
	
	var height = 0;
	var width = 0;	
	
	if(oForm)
	{
		if(jQuery.browser.mozilla == true)
		{
			height = jQuery('html').height();
		}
		else
		{
			height = $(document).height();
		}
		
		width = jQuery(window).width();	
		
		//hide select in IE
		
		if(jQuery.browser.msie == true)
		{
			jQuery(document.forms['manufacturerForm']['manufacturer']).hide();
			jQuery(document.forms['ratingForm']['rate']).hide();
		}
		
		jQuery(document.getElementById('searchoverlay')).show();
		jQuery(document.getElementById('searchoverlay')).height(height);
		
		jQuery(document.getElementById('advancedsearch')).css('left',((width-400)/2));
		jQuery(document.getElementById('advancedsearch')).css('top',190);
		
		jQuery(document.getElementById('advancedsearch')).show();
		
		if(jQuery.browser.mozilla == true)
		{
			jQuery(document.getElementById('table')).dropShadow({left: 5, top: 5, blur: 2, color: '#444444'});
		}
	}
}

function __hide_advanced_search()
{
	if(jQuery.browser.mozilla == true)
	{
		jQuery(document.getElementById('table')).removeShadow();
	}
	
	jQuery(document.getElementById('advancedsearch')).hide();
	jQuery(document.getElementById('searchoverlay')).hide();
	
	//show select in IE
		
	if(jQuery.browser.msie == true)
	{
		jQuery(document.forms['manufacturerForm']['manufacturer']).show();
		jQuery(document.forms['ratingForm']['rate']).show();
	}
}

function __display_advanced_search_preferences()
{
	var oForm = document.forms['searchFormPreferences'];
	
	var height = 0;
	var width = 0;	
	
	if(oForm)
	{
		if(jQuery.browser.mozilla == true)
		{
			height = jQuery('html').height();
		}
		else
		{
			height = $(document).height();
		}
		
		width = jQuery(window).width();	
		
		//hide select in IE
		
		if(jQuery.browser.msie == true)
		{
			jQuery(document.forms['manufacturerForm']['manufacturer']).hide();
			jQuery(document.forms['ratingForm']['rate']).hide();
		}
		
		jQuery(document.getElementById('searchoverlay-preferences')).show();
		jQuery(document.getElementById('searchoverlay-preferences')).height(height);
		
		jQuery(document.getElementById('advancedsearch-preferences')).css('left',((width-400)/2));
		jQuery(document.getElementById('advancedsearch-preferences')).css('top',190);
		
		jQuery(document.getElementById('advancedsearch-preferences')).show();
		
		if(jQuery.browser.mozilla == true)
		{
			jQuery(document.getElementById('table-preferences')).dropShadow({left: 5, top: 5, blur: 2, color: '#444444'});
		}
	}
}

function __hide_advanced_search_preferences()
{
	if(jQuery.browser.mozilla == true)
	{
		jQuery(document.getElementById('table-preferences')).removeShadow();
	}
	
	jQuery(document.getElementById('advancedsearch-preferences')).hide();
	jQuery(document.getElementById('searchoverlay-preferences')).hide();
	
	//show select in IE
		
	if(jQuery.browser.msie == true)
	{
		jQuery(document.forms['manufacturerForm']['manufacturer']).show();
		jQuery(document.forms['ratingForm']['rate']).show();
	}
}

function hideWait(){
	$('#waitoverlay').css('position','absolute');
	$('#waitoverlay').hide();
	$('#wait').css('position','absolute');
	$('#wait').hide();
}

function showWait(){
	var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
	if (!e){
		var e = window.event;
	}
		
	if(isIE6){
		height = $(document).height();
		
		if(e.pageY === undefined) {
			var standardBody = (document.compatMode=="CSS1Compat")? document.documentElement: document.body;
			e.pageY = e.clientY + standardBody.scrollTop;
		}
			
		var marginTop = $('#wait div').css('margin-top').replace('px','') * 1 - e.clientY + e.pageY;
		
		$('#waitoverlay').height(height);
		$('#waitoverlay').show();
			
		$('#wait div').css('margin-top', marginTop+'px')
		$('#wait').show();
	}
	else{
		$('#waitoverlay').css('position','fixed');
		$('#waitoverlay').show();
		$('#wait').css('position','fixed');
		$('#wait').show();
	}
}
