
	var IE6UPDATE_OPTIONS = {
	  icons_path: "http://static.ie6update.com/hosted/ie6update/images/",
	  message: "Internet Explorer is missing updates required to view this site. Click here to update..."
	}
	AudioPlayer.setup("/reg2010/audio-player/player.swf", {  
                width: 290,
				transparentpagebg: "yes"
            });  
$(document).ready(function(){
	$("#overlayDiv").hide();
	$(document).pngFix();
	$("#searchli .NormalTextBox").attr('placeholder','Search Site');
	$("#searchli .NormalTextBox").placeHeld();
	var remove = 0;
	var inprocess = 0;
	var show = 1;
	var ie6 = 0;
	var ie7 = 0;
	var follow = 1;
	numSlides = 5;
	count = 1;
	stopped = false;
	
	$(".closePopup").click(function () {
		$(".requestPopup").hide();
	});

	sidenavs = 0;
	$("#secondnav li").each(function(){
		if($(this).html().length > 2)
		{
			sidenavs++;
		}
	});
	
	if(sidenavs == 0)
	{
		$("#secondnav").hide();
	}
	
	$("a.bio-title").fancybox();
	
	
	$(".mainWindow .c_footer").each(function(){
		if($(this).html().length >= 50)
		{
			$(this).show();
		}
	});
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		ie6 = 1;
	}
	
	if ($.browser.msie && $.browser.version.substr(0,1)<8) {
		ie7 = 1;
	}
	
	$(document).everyTime(10000, "slideTimer", function(i) {

			next = count + 1;
			if(next == 6){next = 1; count = 5;}
			if(count == 6){count = 1; next = 2;}
			
			if(ie7 == 1)
			{
				$("#mw_" + (count)).css('display','none');
				$("#mw_" + next).css('display','block');;
			}
			else
			{
				$("#mw_" + (count)).fadeOut("slow");
				$("#mw_" + next).fadeIn("slow");
			}
			
			liIndex = 0;
			
			$("#slidenav li").each(function()
			{
				
				if(liIndex == (next - 1)){
					$("#slidenav li").removeClass("highlighted");
					$(this).addClass("highlighted");
				}
				liIndex++;
			});
			
			divIndex = 0;
			
			$("#slides .container").each(function()
			{
				
				if(divIndex == (next - 1)){
					$("#slides .container").addClass("noshow");
					$(this).removeClass("noshow");
				}
				divIndex++;
			});
			
			
			count++;
	});
	
	$(".subnav div ul li a").each(function()
	{
		$(this).parent().addClass("hasLink");
	});
	$("#slidenav li").click(function(){
		index = $(this).find("a").html();
		$(document).stopTime("slideTimer");
		if(count != index)
		{
			if(ie7 == 1)
			{
				$("#mw_" + (count)).css('display','none');
				$("#mw_" + index).css('display','block');;
			}
			else
			{
				$("#mw_" + (count)).fadeOut("slow");
				$("#mw_" + index).fadeIn("slow");
			}
			$("#slidenav li").removeClass("highlighted");
			$(this).addClass("highlighted");
			$("#slides .container").hide();
			$("#slides #slide" + index).show();
			count = index;
		}
	});
	

	
	if (ie7 == 1) {
		$("body").addClass("retardery");
		$("body").addClass("ie7");
	}
	
	if($.cookie("popupShown") != "Yes")
	{
		$("#requestPopup").show();
		$.cookie("popupShown","Yes",{ expires: 30 });
	}
/*
	if($("#searchBox").val() == "")
	{
		$("#searchBox").val($("#searchBox").attr("placeholder"));
	}

	$("#searchBox").click(function() {
		if($("#searchBox").val() == $("#searchBox").attr("placeholder"))
		{
			$("#searchBox").val("");
		}
	});
*/
		//$("#main_nav .subnav").hide();
		
		//$("#main_nav .subnav").css('visibility', 'visible');
	$("#main_nav .navLink").hover(function() {
		if(ie6 == 0 && ie7 == 0)
		{
			$("#overlayWrap").removeClass('hiddenDiv');
			$("#overlayDiv").show();
		}
	}, function() {
		if(ie6 ==0){

		}
	});
	
	$("#main_nav").hover(function() {
	}, function() {
		if(ie6 == 0 && ie7 == 0){
			$("#overlayDiv").hide();
			$("#overlayWrap").addClass('hiddenDiv');
		}
	});
	
	$("#roundlinks li").hover(function(){
		if(!$(this).find("a img").attr('src').match("-over"))
		{
			$(this).find("a img").attr('src',$(this).find("a img").attr('src').replace('.png','-over.png'));
		}
	}, function() 
	{
		$(this).find("a img").attr('src',$(this).find("a img").attr('src').replace('-over',''));
	}
	);
	
	$("#sidenav li").hover(function(){
		$(this).addClass('sidenav-over');
	}, function() 
	{
		$(this).removeClass('sidenav-over');
	}
	);
	
	
		$(".subnav").hover(function() {
			follow = 0;
	}, function() {

			follow = 1;

	});
	
	
		$("#searchli").hover(function() {
		if(ie6 == 0)
		{
			$("#overlayDiv").hide();
			$("#overlayWrap").addClass('hiddenDiv');
		}
	}, function() {
		if(ie6 ==0){
		}
	});
	  



	  $("#main_nav .navLink").click(function(){
			if(follow == 1)
			{
				top.location = $(this).find("a").attr('href');
			}
	  });
	 $("#main_nav .navLink").hover(function(){
        $(this).addClass("navOver");
        $('.subnav:first',this).show();
    
    }, function(){
    
        $(this).removeClass("navOver");
        $('.subnav:first',this).hide();
    
    });
	
	$("#requestPopup #closeBtn").click(function(){
		$("#requestPopup").fadeOut();
		
		return false;
	});
	
	$("#requestBtn").click(function(){
		if($("#rf").length > 0)
		{
			window.location = "#rf";
			$("#contact_firstname").focus();
		}
		else
		{
			$("#requestPopup .error").hide();
			$("#requestPopup").show();
			$("#requestPopup #requestThanks").hide();
			$("#requestPopup #requestForm").show();
		}
		return false;
	});


	
	$(".contactSubmit").click(function()
	{
        
		var prefix = "";
		if($(this).attr("id").replace("contact","") != $(this).attr("id"))
		{
			prefix = "contact";
		}
		error = 0;
		$(".error").hide();
		
		if($("#contactfirstname").val().length < 1)
		{
			$("#" + prefix + "firstnameError").show();
			error = 1;
		}
		if($("#contactlastname").val().length < 1)
		{
			$("#" + prefix + "lastnameError").show();
			error = 1;
		}
		if($("#contactEmail").val().length < 6)
		{
			$("#" + prefix + "emailError").show();
			error = 1;
		}
		if($("#" + prefix + "phone").val().length < 10)
		{
			$("#" + prefix + "phoneError").show();
			error = 1;
		}
		
		if($("#" + prefix + "state option:selected").val().length != 2)
		{
			$("#" + prefix + "stateError").show();
			error = 1;
		}
		/*
		if($("#" + prefix + "zip").val().length < 5)
		{
		$("#" + prefix + "zipError").show();
		error = 1;
		}
		if($("#" + prefix + "type option:selected").val().length < 2)
		{
		$("#" + prefix + "typeError").show();
		error = 1;
		}*/

		if(error != 1)
		{
			$("#" + prefix + "_requestForm").hide();
			$("#" + prefix + "_requestSending").show();	
			$.post("/PostContact.aspx",
					{ firstname: $("#" + prefix + "firstname").val(), 
					lastname: $("#" + prefix + "lastname").val(),
					company: $("#" + prefix + "company").val(),
					email: $("#" + prefix + "Email").val(),
					phone: $("#" + prefix + "phone").val(),
					state: $("#" + prefix + "state option:selected").val(),
					zip: $("#" + prefix + "zip").val(),
					type: $("#" + prefix + "type option:selected").val() ,
					comments: $("#" + prefix + "comments").val() ,
					newsletter: ($("#" + prefix + "newsletter").is(':checked') ? "Yes" : "No") ,
					success: function(data)
					{
						
						$("#" + prefix + "_requestThanks").show();
						$("#" + prefix + "_requestSending").hide();
						window.location = "http://regulatorycompliance.com";
					}}
			);
			

		}

		return false;
	});

	$(".contactSubmit2").click(function()
	{
	    //alert("1" + $("#contactfirstname2").val().length);
		var prefix = "";
		if($(this).attr("id").replace("contact","") != $(this).attr("id"))
		{
			prefix = "contact";
		}
		error = 0;
		$(".error").hide();
		
		if($("#contactfirstname2").val().length < 1)
		{
		$("#" + prefix + "firstnameError2").show();
		error = 1;
		}
		
		if($("#contactlastname2").val().length < 1)
		{
		$("#" + prefix + "lastnameError2").show();
		error = 1;
		}
		
		if($("#contactEmail2").val().length < 6)
		{
		$("#" + prefix + "emailError2").show();
		error = 1;
		}
		
		if($("#contactphone2").val().length < 10)
		{
		$("#contactphoneError2").show();
		error = 1;
		}
		
		if($("#contactstate2 option:selected").val().length != 2)
		{
		$("#contactstateError2").show();
		error = 1;
		}
		/*
		if($("#" + prefix + "zip").val().length < 5)
		{
		$("#" + prefix + "zipError2").show();
		error = 1;
		}
		if($("#" + prefix + "type option:selected").val().length < 2)
		{
		$("#" + prefix + "typeError2").show();
		error = 1;
		}*/

		//alert("2-C");
		if(error != 1) {
		    //alert("3");
			$("#" + prefix + "_requestForm").hide();
			$("#" + prefix + "_requestSending").show();
			//alert("4");
			$.post("/PostContact.aspx",
					{ firstname: $("#" + prefix + "firstname2").val(), 
					lastname: $("#" + prefix + "lastname2").val(),
					company: $("#" + prefix + "company2").val(),
					email: $("#" + prefix + "Email2").val(),
					phone: $("#" + prefix + "phone2").val(),
					state: $("#" + prefix + "state2 option:selected").val(),
					zip: $("#" + prefix + "zip2").val(),
					type: $("#" + prefix + "type2 option:selected").val() ,
					comments: $("#" + prefix + "comments2").val() ,
					newsletter: ($("#" + prefix + "newsletter2").is(':checked') ? "Yes" : "No") ,
					success: function(data)
					{
						
						$("#" + prefix + "_requestThanks").show();
						$("#" + prefix + "_requestSending").hide();
						window.location = "http://regulatorycompliance.com/";
					}}
			);
					//alert("5");	

		}
		//alert("6");
		return false;
	});
	
	function getParameterByName( name )
	{
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null )
		return "";
	  else
		return results[1];
	}
	
	

		
	 
    function isEmpty( inputStr ) 
	{ 
	if ( null == inputStr || "" == inputStr ) 
	{
	return true; 
	} 
	return false; 
	}
	
	
	function checker() 
	{
		
		if(isEmpty($("#email").val()) && isEmpty($("#firstname").val())&& isEmpty($("#lastname").val())&& isEmpty($("#company").val())&& isEmpty($("#phone").val())&& isEmpty($("#zip").val())&& isEmpty($("#comments").val()))
		{
			$(".home #requestPopup").fadeOut();
		
		}
	}
	
	setTimeout(checker, 8000);
	
	
	
	$("a.searchbox img").css("cursor","pointer");
	$("a.searchbox img").click(function(){
		var searchTerm = $("div#dnn_mainHeader_dnnSEARCH_ClassicSearch input").first().val().trim();
		doSearch(searchTerm);
	});
	$("div#dnn_mainHeader_dnnSEARCH_ClassicSearch input").keyup(function(e){ 
		var code = e.which; 
		if(code==13){
			e.preventDefault();
			var searchTerm = $("div#dnn_mainHeader_dnnSEARCH_ClassicSearch input").first().val().trim();
			doSearch(searchTerm);
		} 
	});
	
	function doSearch(searchTerm)
	{
		if(searchTerm.length > 0)
		{
			//NO ADS window.location = "/RegulatoryCompliance/Search.aspx?cx=012251872912141175046:dlkfzdaf6ne&cof=FORID%3A11&ie=UTF-8&sa=Search&siteurl=regulatorycompliance.com&q=" + searchTerm;
			window.location = "/Search.aspx?cx=001193226402806295648%3Adlkfzdaf6ne&cof=FORID%3A11&ie=UTF-8&sa=Search&siteurl=regulatorycompliance.com&q=" + searchTerm;
		}
	}

});

