// JavaScript Document
$(document).ready(function(){
	/*if($.browser.msie){
		if($.browser.version < 7){
			$(".ulsubmenu").each(function(){
				var pos  = $(this).parent().position();
				$(this).css({"left":pos.left,"top":"125px"});
			});
		}
	}
	$(".haschild").hover(function(event){
		if($.browser.msie && $.browser.version < 7){
			$(this).removeClass("menu_top").addClass("menu_top_active");
		}
		$(".ulsubmenu").each(function(){
			$(this).slideUp("fast");
		});
		if($(this).children(".ulsubmenu").css("display") == "none"){
			$(this).children(".ulsubmenu").slideDown("fast");	
		}			
	},function(event){
		if($.browser.msie && $.browser.version < 7){
			$(this).removeClass("menu_top_active").addClass("menu_top");
		}
	});
	$("#haschild").mouseout(function(){
		
	});
	$(".menu_top").mouseover(function(event){
		if($(this).attr("id") != "haschild"){
			$(".ulsubmenu").each(function(){
				$(this).slideUp("fast");
			});
		}
		event.stopPropagation();
	});
	$("#PageHead").mouseover(function(event){
		$(".ulsubmenu").each(function(){
			$(this).slideUp("fast");
		});
		event.stopPropagation();
	});
	$(".ulsubmenu").hover(function(event){
		$(this).parent(".haschild").removeClass("menu_top");
		$(this).parent(".haschild").addClass("menu_top_active");
		event.stopPropagation();
	},function(event){
		$(this).parent(".haschild").removeClass("menu_top_active").addClass("menu_top");
		//if($(this).parent().attr("class") == "menu_top"){
			$(this).slideUp("fast");
		//}
		event.stopPropagation();
	});
	$(".submenu").click(function(){
		//alert($(this).children(".submenu a"));
		document.location.href = $(this).children(".submenu a").attr("href");
	});
	$(".menu_top_active").hover(function(event){
		$(".ulsubmenu").each(function(){
			$(this).slideUp("fast");
		});
	});
	*/
	$("#benefits").before("<div class='benefits_top'></div>");
	$("#benefits").after("<div class='benefits_bottom'></div>");
	$(".benefits2").each(function(){
		$(this).before("<div class='benefits2_top'></div>");
		$(this).after("<div class='benefits2_bottom'></div>");						  
	});
	//$("body").html($("body").html().replace(/&reg;/g,"<span class='reg'>&reg;</span>"));
	$(".ajemail").each(function(i){
		var id = $(this).attr('id');
		$.get("http://www.afshuck.net/includes/ajax_email.php",{name:$(this).attr("id")},function(data){
			$("#"+id).attr("href","mailto:"+data);
			$("#"+id).html(data);
		});
		
	});
});

function str_replace(haystack,needle,replacement){
	//var temp = haystack.split(needle);
	//return temp.join(replacement)
}
