$(document).ready(function(){
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"body h1", sFlashSrc:"/menaflex/univers_de.swf", sColor:"#003366", sLinkColor:"#003366", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0,sWmode:"transparent"}));
		//sIFR.replaceElement(named({sSelector:".call-to-action h2", sFlashSrc:"/menaflex/univers_b.swf", sColor:"#003366", sLinkColor:"#003366", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=right",sWmode:"transparent"}));
		//sIFR.replaceElement(named({sSelector:".call-to-action h3", sFlashSrc:"/menaflex/univers.swf", sColor:"#003366", sLinkColor:"#003366", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=right"}));
	};


	$('#top_menu ul li').hover(function() {
		$(this).addClass("selected");
	}, function() {
		$(this).removeClass("selected");
	});	
	
});

function togglePublished(table, id){
	runFunction('toggleDbField', "table="+table+"&field=published&id="+id, function(response){
		$("#check_published_"+id).removeClass('check0');	
		$("#check_published_"+id).removeClass('check1');	
		$("#check_published_"+id).addClass('check'+response.data.new_value);
		
		$('table tr').removeClass('selected');
		$('#tablerow_'+id).addClass('selected');		
		
	})
}

function toggleSelected(el){
	alert(el);
}

function clearSearch(el){
	if(el.value == 'Search Menaflex'){
		el.value = '';	
	}
}

function goTo(url) {
	window.location = url;
}

function printSpecial()
{
	var gAutoPrint = false;
	
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		html += '\n</HE' + 'AD>\n<BODY class="print"><form><p class="print_button" align="center"><input type="button" value=" Print this page " onclick="window.print();return false;" /></p></form><div class="print_area"><img src="/images/menaflex_logo.gif"  alt="Menaflex Logo" hspace="12"></a>\n';
		
		var printReadyElem = document.getElementById("content");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</div><form><p class="print_button" align="center"><input type="button" value=" Print this page " onclick="window.print();return false;" /></p></form></BO' + 'DY>\n</HT' + 'ML>';
		
		var win = null;
		LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
		settings = 'height=600,width=600,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable,menubar=1';
		printWin = window.open("","printSpecial",settings)
		
		printWin.document.open();
		printWin.document.write(html);
				
		printWin.document.close();
		if (gAutoPrint)	printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

var win = null;
function PopThis(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable'
	win = window.open(mypage,myname,settings)
}
