var quotes = new Array();
var quoteImage = new Array();

quotes[0] = '"Vi valgte en kør selv ferie og fik USA Tours til at planlægge en fantastisk rute rundt i Californien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vulputate velit a velit consectetur luctus. Etiam in malesuada turpis. Praesent at accumsan elit." &ndash; <strong>Familien Jensen, København</strong>';
quoteImage[0] = "/wp-content/uploads/2011/08/img-info-home.png";


quotes[1] = '"Vi valgte en kør selv ferie og fik USA Tours til at planlægge en fantastisk rute rundt i Californien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vulputate velit a velit consectetur luctus. Etiam in malesuada turpis. Praesent at accumsan elit." &ndash; <strong>Familien Jensen, København</strong>';
quoteImage[1] = "/wp-content/uploads/2011/08/img-info-home.png";


quotes[2] = '"Vi valgte en kør selv ferie og fik USA Tours til at planlægge en fantastisk rute rundt i Californien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vulputate velit a velit consectetur luctus. Etiam in malesuada turpis. Praesent at accumsan elit." &ndash; <strong>Familien Jensen, København</strong>';
quoteImage[2] = "/wp-content/uploads/2011/08/img-info-home.png";


var frmValid = true;

$(function(){
		   
	
		   
	if($.browser.safari){
		$(".with_frm_style p.submit").css({"padding-top":"8px"});
		if(location.href.indexOf('/kontakt/') == -1){
			$(".Phonering_texttop, .Phonering_texttop2").css("margin-top", "-18px");
		}
		$(".Title_Thumbnail_ImgNY").css("margin-bottom", "12px");
		$(".blog .type-post:first").css("margin-top", "5px");
		$("#label-3-3").css("padding-left", "35px");
		$("#label-3-3").css("margin-left", "24px");
		$("#searchsubmit").css("top", "-42px");
		/*
		


		*/
		if(navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Chrome") == -1){
			$("#frm_field_36_container").css({
				"margin-top" : "-95px"
			});/*
			$(".with_frm_style .form-field").css({
				"margin-top" : "2px"
			});*/
		}
		
	}
	if($.browser.msie){
		$("#label-3-3").css("margin-left", "35px");
	}
	if($("#BlocSidebar_NY").length > 0){
		$("#BlocSidebar_NY").find("h5").css({
			"border-bottom":"2px solid #e5e5e5"	,
			"margin-right" : "10px",
			"margin-bottom" : "10px",
			"padding-bottom" : "5px"
		});
		$("#Block_ThumbnailImages").before('<div style="margin-left:12px;">'+$("#BlocSidebar_NY").html()+'</div>');
		$("#BlocSidebar_NY").remove();
	}
	if($("#BlocSidebar_NY2").length > 0){
		$("#BlocSidebar_NY").find("h5").css({
			"border-bottom":"2px solid #e5e5e5"	,
			"margin-right" : "10px",
			"margin-bottom" : "10px",
			"padding-bottom" : "5px"
		});
		$("#Block_ThumbnailImages").before('<div style="margin-left:12px;">'+$("#BlocSidebar_NY2").html()+'</div>');
		$("#BlocSidebar_NY2").remove();
	}
		   
	if($.browser.msie){
		setTimeout("moveLikeBox()", 1500);	
	}
	
	if($("#post-269 .cf_li_err").length < 1){
		$("#post-269 #sendbutton3").css("margin-top", "-173px");
	}
	setTimeout("simulateClick()", 1500);
	$("#s").val("Søg");
	$("#s").focus(function(){
		if($(this).val() == "Søg"){
			$(this).val("")
		}
	});
	$("#s").blur(function(){
		if($(this).val() == ""){
			$(this).val("Søg")
		}
	});
	$(".frm_form_widget #form_b4sqrc input[type='submit']").click(function(event){
		event.preventDefault();
		$(".frm_form_widget #form_b4sqrc input[type='text']").each(function(){
			if($(this).val() == ""){
				alert("udfyld venligst alle felterne");
				frmValid = false;
				return false;
			} else {
				frmValid = true;
			}																
		});
		if(frmValid){
			$(".frm_form_widget #form_b4sqrc").submit();
		}
	});
	/*
	$(".book-mode #sendbutton").removeAttr("onclick");
	$(".book-mode #sendbutton").unbind('click');
	$(".book-mode #sendbutton").click(function() { return false; });
	$(".book-mode #sendbutton").click(function(event){
		event.preventDefault();
		$(".book-mode input[type='text']").each(function(){
			if($(this).val() == ""){
				alert("udfyld venligst alle felterne");
				frmValid = false;
				return false;
			} else {
				frmValid = true;
			}																
		});
		if(frmValid){
			$(".book-mode").submit();
		}
	});*/
	if(location.hash == "#usermessagea"){		
		if($("#usermessagea").attr("class").indexOf("failure") == -1){
			$(".TextBestil").text("Tak for din henveldelse, du vil modtage en bekræftelse hvis mødet er muligt")
			$(".TextBestil").parent().next().remove();
		} else {
			$(".TextBestil").text("Husk at udfylde alle felterne med de korrekte informationer.");
			$(".TextBestil").parent().next().remove();
		}
		$("#usermessagea").remove();
	}	
	/*
	$(".katalog #sendbutton3").removeAttr("onclick");
	$(".katalog #sendbutton3").unbind('click');
	$(".katalog #sendbutton3").click(function() { return false; });
	$(".katalog #sendbutton3").click(function(event){
		event.preventDefault();
		$(".katalog input[type='text']").each(function(){
			if($(this).val() == ""){
				alert("udfyld venligst alle felterne");
				frmValid = false;
				return false;
			} else {
				frmValid = true;
			}																
		});
		if(frmValid){
			if($(".katalog input[type='checkbox']").is(':checked')){
				frmValid = true;
			} else {
				alert("Du skal accepterer betingelserne");
				frmValid = false;
			}
		}
		if(frmValid){
			$(".katalog").submit();
		}
	});*/
	if(location.hash == "#usermessage3a"){
		
		if($("#usermessage3a").attr("class").indexOf("failure") == -1){
			$(".Text2katalogSpan").text("Tak for din henveldelse, du vil modtage vores katalog på din e-mail.")
		} else {
			$(".Text2katalogSpan").text("Husk at udfylde alle felterne med de korrekte informationer.");
		}
		$("#usermessage3a").remove();
	}
	/*
	$(".bestil-tilbud #sendbutton2").removeAttr("onclick");
	$(".bestil-tilbud #sendbutton2").unbind('click');
	$(".bestil-tilbud #sendbutton2").click(function() { return false; });
	$(".bestil-tilbud #sendbutton2").click(function(event){ 
		event.preventDefault();
		$(".bestil-tilbud input[type='text']").each(function(){
			if($(this).val() == ""){
				alert("udfyld venligst alle felterne");
				frmValid = false;
				return false;
			} else {
				frmValid = true;
			}																
		});
		if(frmValid){
			$(".bestil-tilbud").submit();
		}
	});*/
	if(location.hash == "#usermessage2a"){
		if($("#usermessage2a").attr("class").indexOf("failure") == -1){
			$(".TextBestil").text("Tak for din henveldelse, du vil snarest muligt modtage et tilbud der passer til dig.");
			$(".TextBestil").parent().next().remove();
		} else {
			$(".TextBestil").text("Husk at udfylde alle felterne med de korrekte informationer.");
			$(".TextBestil").parent().next().remove();
		}
		$("#usermessage2a").remove();
		console.log($.browser.mozilla);
		if($.browser.mozilla){
			$(".entry-content").css("padding", "64px 0 0");
		}

	}	
	
});

function moveLikeBox(){
	$(".blog .fb_iframe_widget").css("margin-left", "30px");
}

function showLikeBox(){
	$(".blog .fb_iframe_widget").css("display", "block");
	$(".blog .fb_iframe_widget").css("margin-top", $("#categories-2").height());
}

function simulateClick(){
	$(".imgcalendar").click();
}
/*
function textOnImage(color){
	$("#branding").append('<div style="position:absolute;z-index:9999;"><h1 style="position:relative;top:-65px;left:20px;margin:0px;color:'+color+'">'+$(".entry-content > h1:first").text()+'</h1></div>');
	$(".entry-content > h1:first").remove();
}
*/
/*
function getCustemorReview(type){
	var maxNumber = quotes.length
	var randomnumber = Math.floor(Math.random()*maxNumber)
	
	switch(type){ 
		case "vertical":
			if($(".page-id-82 #Block_ThumbnailImages").length > 0){
				$(".page-id-82 #Block_ThumbnailImages").css({
					"position" : "static"
				});	
			}
			if($(".page-id-82 .Title_Thumbnail_ImgNY").length > 0){
				$(".page-id-82 .Title_Thumbnail_ImgNY").css({
					"margin-left" : "0px",
					"position" : "static"
				});	
			}
			
			$("#primary").append("<h5 style='margin-left:12px;margin-top: 20px; border-bottom: 5px solid #E5E5E5;padding-bottom:5px;margin-bottom:10px;width:215px;'>Kundeudtalelse</h5>");
			$("#primary").append('<img style="margin-left:26px;margin-top:5px;margin-bottom:20px;" src="'+quoteImage[randomnumber]+'" border="0" />');
			$("#primary").append("<blockquote style='position:static;margin: 0 0 0 10px;width: 230px;'><p><span style='width:200px;height:165px;'>"+quotes[randomnumber]+"</span></p></blockquote>");			
		break;
		case "horizontal":
			$(".entry-content").after('<table cellspacing="0" style="border-bottom: 5px solid #E5E5E5;margin-top:4px;margin-left: 20px;width: 650px;" cellpadding="0" border="0" class="customerQuote"><tr><td><img style="margin-left:26px;margin-top:5px;margin-bottom:20px;" src="'+quoteImage[randomnumber]+'" border="0" /></td><td><blockquote style="margin-top:10px;"><p><span>'+quotes[randomnumber]+'</span></p></blockquote></td></tr></table>');
		break;
	}
}*/

function getCustemorReview(type){
	
	
	switch(type){ 
		case "vertical":
			if($(".page-id-82 #Block_ThumbnailImages").length > 0){
				$(".page-id-82 #Block_ThumbnailImages").css({
					"position" : "static"
				});	
			}
			if($(".page-id-82 .Title_Thumbnail_ImgNY").length > 0){
				$(".page-id-82 .Title_Thumbnail_ImgNY").css({
					"margin-left" : "0px",
					"position" : "static"
				});	
			}
			$.ajax({
				url: "/kundeudtalelser/",
				success: function(response){
					tmp = response.split('entry-content">')[1].split("</div>")[0];
					$("#primary").append('<div id="tmp">'+tmp+'</div>');
					var maxNumber = $("#tmp").find(".customerQuote").length
					var randomnumber = Math.floor(Math.random()*maxNumber)
					var imgsrc = $("#tmp .customerQuote:eq("+randomnumber+")").find("img").attr("src");
					var quote = $("#tmp .customerQuote:eq("+randomnumber+")").find("blockquote p").html();
					$("#tmp").remove();
					$("#primary").append("<h5 style='margin-left:12px;margin-top: 20px; border-bottom: 5px solid #E5E5E5;padding-bottom:5px;margin-bottom:10px;width:215px;'>Kundeudtalelse</h5>");
					$("#primary").append('<img style="margin-left:26px;margin-top:5px;margin-bottom:20px;" src="'+imgsrc+'" border="0" />');
					$("#primary").append("<blockquote style='position:static;margin: 0 0 0 10px;width: 230px;'><p style=\"height:180px;background:url('/wp-content/themes/twentyten/images/quoteSmall.jpg') no-repeat;padding:8px 0px 0px 10px;width:210px;\">"+quote+"</p></blockquote>");
				}
			});
						
		break;
		case "horizontal":
			$.ajax({
				url: "/kundeudtalelser/",
				success: function(response){
					tmp = response.split('entry-content">')[1].split("</div>")[0];
					$("#primary").append('<div id="tmp">'+tmp+'</div>');
					var maxNumber = $("#tmp").find(".customerQuote").length
					var randomnumber = Math.floor(Math.random()*maxNumber)
					var imgsrc = $("#tmp .customerQuote:eq("+randomnumber+")").find("img").attr("src");
					var quote = $("#tmp .customerQuote:eq("+randomnumber+")").find("blockquote p").html();
					$("#tmp").remove();
					$(".entry-content").after('<table cellspacing="0" style="border-bottom: 5px solid #E5E5E5;margin-top:4px;margin-left: 20px;width: 650px;" cellpadding="0" border="0" class="customerQuote"><tr><td><img style="margin-left:26px;margin-top:5px;margin-bottom:20px;" src="'+imgsrc+'" border="0" /></td><td><blockquote style="margin-top:10px;"><p>'+quote+'</p></blockquote></td></tr></table>');
				}
			});
		break;
	}
}
