// JavaScript Document// JavaScript Document
var blank = new Image();
 			blank.src = '../images/blank.gif';

			
			$(document).ready(function(){
				var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
				 if (badBrowser) {
					 // get all pngs on page
					 $('img[src$=.png]').each(function() {
						 if (!this.complete) {
							 this.onload = function() { fixPng(this) };
						 } else {
							 fixPng(this); 
						 }
					 });
				 }

				
				$('a[href*=#]').click(function() {
				if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
				&& location.hostname == this.hostname) {
					var $target = $(this.hash);
					$target = $target.length && $target
					|| $('[name=' + this.hash.slice(1) +']');
					if ($target.length) {
					var targetOffset = $target.offset().top - 40;
					$('html,body')
					.animate({scrollTop: targetOffset}, 1000);
					 return false;
					}
				}
			});
			
			
	//hide message_body after the first one
	$(".DL .DL_text").hide();

	//toggle message_body
	$(".DL_link").click(function(){
	  $(this).next(".DL_text").slideToggle(500)
	  return false;
	});


			
				
	$(".feedback_btn").click(function(){															
		
		//centerPopup();
		
		loadPopup();
		
	});
	
	$("#popupFeedbackClose").click(function(){  
		disablePopup();  
	});  
	//Click out event!  
	$("#backgroundPopup").click(function(){  
		disablePopup();  
	});  
	//Press Escape event!  
	$(document).keypress(function(e){  
		if(e.keyCode==27 && popupStatus==1){  
			disablePopup();  
		}  
	});
	
	function loadPopup() {
		if(popupStatus == 0) {
			$('#backgroundPopup').css({
				"opacity" : "0.7"
			});
			$('#backgroundPopup').fadeIn("slow");
			$('#popupFeedback').fadeIn("slow");
			popupStatus = 1;
		}
	}
	
	function disablePopup() {
		if(popupStatus == 1) {
			$('#backgroundPopup').fadeOut("slow");
			$('#popupFeedback').fadeOut("slow");
			popupStatus = 0;
		}
	}
	
	function centerPopup(){  
		//request data for centering  
		var windowWidth = document.documentElement.clientWidth;  
		var windowHeight = document.documentElement.clientHeight;  
		var popupHeight = $("#popupFeedback").height();  
		var popupWidth = $("#popupFeedback").width();  
		//centering  
		$("#popupFeedback").css({  
			"position": "absolute",  
			"top": windowHeight/2-popupHeight/2,  
			"left": windowWidth/2-popupWidth/2  
		});  
		//only need force for IE6  

		$("#backgroundPopup").css({  
			"height": windowHeight  
		});
	}
				
				function fixPng(png) {
				 // get src
				 var src = png.src;
				 // set width and height
				 if (!png.style.width) { png.style.width = $(png).width(); }
				 if (!png.style.height) { png.style.height = $(png).height(); }
				 // replace by blank image
				 png.onload = function() { };
				 png.src = blank.src;
				 // set filter (display original image)
				 png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
			 }



			});
			
			$(".makeDark").click(function(){
					alert('test');
					//$('body, #background, .menu_col, .content_col').addClass('dark'); }
					//function() { $('body, #background, .menu_col, .content_col').removeClass('dark'); }
				});






