/**
 * @author Georgi Rangelov
 */
function seeMore(){
	var seeMore = "Виж повече";
	var goUp = "Затвори";
	var oHeight = 580;
	var wrapHeight;
	var textHeight;
	wrapHeight = $("#wrapDiv").height();
	textHeight = $("#contentDiv").height();
	if(oHeight == wrapHeight && textHeight > wrapHeight){
		$("#wrapDiv").animate({height:textHeight+"px"}, 300);
		$("#seeMore").html(goUp);
		$("#contentDiv").css("background","#ffffff");
	}else{
		$("#wrapDiv").animate({height:oHeight+"px"}, 100);
		$("#contentDiv").css("background","none");
		$("#seeMore").html(seeMore);
	}
}

function playStop(){
	var swf = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="380"><param name="movie" value="/files/swf/stop.swf" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="/files/swf/stop.swf" width="480" height="380"><!--<![endif]--><p></p><!--[if !IE]>--></object><!--<![endif]--></object>';
	modalWindow.content = swf;
	modalWindow.open();
}

function playPose(){
	var swf = '<object width="480" height="300"><param name="movie" value="http://www.youtube.com/v/iV5z41KzmgM&hl=en_US&fs=1&color1=0x5d1719&color2=0xcd311b&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/iV5z41KzmgM&hl=en_US&fs=1&color1=0x5d1719&color2=0xcd311b&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="300"></embed></object>';
	modalWindow.content = swf;
	modalWindow.open();
}

var modalWindow = {  
     parent:"body",  
     windowId:null,  
     content:null,  
     width:490,  
     height:390,  
     close:function()  
     {  
         $(".modal-window").remove();  
         $(".modal-overlay").remove();  
     },  
     open:function()  
     {  
         var modal = "";  
         modal += "<div class=\"modal-overlay\"></div>";  
         modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\"><a class=\"close-window\">Затвори</a>";  
         
		 modal += this.content;  
         modal += "</div>";      
   
         $(this.parent).append(modal);  
   
         //$(".modal-window").append("<a class=\"close-window\">Затвори</a>");  
         $(".close-window").click(function(){modalWindow.close();});  
         $(".modal-overlay").click(function(){modalWindow.close();});  
     }  
};

function verify(){
	var name = $("#name").val();
	var email = $("#email").val();
	var message = $("#message").val();
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	$(".contactError").css("display", "none");
	
	if(name.length>0 && email.length>0 && message.length>0 ){
		if(reg.test(email) == false) 
			$("#emailErr").css("display","block");
		else
			document.contactForm.submit();	
	}else{
		if(name.length < 3) $("#nameErr").css("display","block");
		if(message.length < 5) $("#mesErr").css("display","block");
		if(reg.test(email) == false) $("#emailErr").css("display","block");
	}
	
}
