$(function() {
	$("label#mn_hint, img#cancel_msg").click(function(event){
		if(this == event.target) {
			$("textarea#varMesages").attr("value", "");
			
			if($('#hint_mn').is(':hidden')) {
				$("div#VideoFile").slideUp("slow");
				$('#hint_mn').fadeIn("slow");
			} else {
				$("div#VideoFile").slideDown("slow");
				$('#hint_mn').fadeOut("slow");
				
			}
		}
	});
});

$(function() {
	$("label#mn_hint2, #cancel_msg2").click(function(event){
		if(this == event.target) {
			$("textarea#varMesages2").attr("value", "");
			if($('#hint_mn2').is(':hidden')) {
				$("div#VideoFile").slideUp("slow");
				$('#hint_mn2').fadeIn("slow");
				var form = $('#SendResponceForm');
				form.submit(function(e){
					e.preventDefault();
					var SendFL = false;
					var MsgText = $("#SendResponceFormvarMesages").val();
					var AppraisalPluss = $("#AppraisalPluss").attr("checked");
					var AppraisalMinus = $("#AppraisalMinus").attr("checked");
					
					if(MsgText && (AppraisalPluss || AppraisalMinus)) SendFL = true;
					if(!SendFL) {
						var h2 = form.find("h2");
						h2.html(h2.text()+" <span style='color: red; float: right; text-decoration: blink;'>Введите текст и поставте оценку отзыва.</span>");
					} else {
						$('#SendResponceForm').unbind().trigger("submit"); 
					};
				});
			} else {
				$("div#VideoFile").slideDown("slow");
				$('#hint_mn2').fadeOut("slow");
				
			}
		}
	});
});


$(function(){
	$("div.highslide-caption div a").live('click',function(e){
		e.preventDefault();
		var vote = $(this);
		if(vote.attr("id")=="error") {
			showRegisterSplash('К сожалению вы не можете проголосовать, потому что не','залогинены или не зарегистрированы на сайте!',0);
		} else {
			var vote_container= $(this).parent();
			if (vote.attr("class") == "vote_minus_image") {
				$.post("/afoto.php", {"intPhotoID": vote.attr("href"), "event": "imgvote", "varAction": "minus"}, function(data){
					var Result = $(data).find("#error");
					if(Result.attr("id") != "error") {
						Result = $(data).find("#OK");
						var VoteConteiner = vote.parent().parent();
						var RemContr = vote.parent().attr("id");
						var CurFotoRating = vote.parent().next().attr("id");
						$.each(hs.clones, function(){
							var CurEl = this;
							var El = $('<div></div>');
							El.html(CurEl['innerHTML']);
							El.find("#RatingAnkets").text("Рейтинг: "+Result.find("#AnketRating").text());
							El.find("#"+CurFotoRating).text("Рейтинг фото: "+Result.find("#PhotoRating").text());
							El.find("#"+RemContr).html("<span id='vote_minus'></span>");
							CurEl['innerHTML'] = El.html();
						});
						$(".highslide-caption .VoteButton").each(function(){
							if($(this).attr("id") == RemContr) $(this).html("<span id='vote_minus'></span>");
						});
						$(document).find("#"+RemContr).html("<span class='vote_minus_image'></span>");
						vote.parent().remove(); //Удаляем кнопки
						vote_container.animate({"marginLeft": "137px"}, "slow").css('marginLeft','137px');
						VoteConteiner.find("#"+CurFotoRating).text("Рейтинг фото: "+Result.find("#PhotoRating").text());	
						$(".highslide-caption #RatingAnkets").each(function(){
							$(this).text("Рейтинг: "+Result.find("#AnketRating").text());
						});
						var AnketRating = Result.find("#AnketRating").text();
						$("#rating_text_content").parent().parent().find("span").remove();
						if(AnketRating > 0) {
							$("#rating_text_content").parent().append("<span id='vote_plus'></span>");
						} else if(AnketRating < 0) {
							$("#rating_text_content").parent().append("<span id='vote_minus'></span>");
						}
						$("#rating_text_content").text(AnketRating);
					}
				}, "html");
		};
	if (vote.attr("class") == "vote_plus_image") {
		$.post("/afoto.php", {"intPhotoID": vote.attr("href"), "event": "imgvote", "varAction": "plus"}, function(data){
			var Result = $(data).find("#error");
			if(Result.attr("id") != "error") {
				Result = $(data).find("#OK");
				var VoteConteiner = vote.parent().parent();
				var RemContr = vote.parent().attr("id");
				var CurFotoRating = vote.parent().next().attr("id");
				$.each(hs.clones, function(){
					var CurEl = this;
					var El = $('<div></div>');
					El.html(CurEl['innerHTML']);
					El.find("#RatingAnkets").text("Рейтинг: "+Result.find("#AnketRating").text());
					El.find("#"+CurFotoRating).text("Рейтинг фото: "+Result.find("#PhotoRating").text());
					
					El.find("#"+RemContr).html("<span id='vote_plus'></span>");
					
					CurEl['innerHTML'] = El.html();
				});
				$(".highslide-caption .VoteButton").each(function(){
					if($(this).attr("id") == RemContr) $(this).html("<span id='vote_plus'></span>");
				});
				$(document).find("#"+RemContr).html("<span class='vote_plus_image'></span>");
				vote.parent().html("<span id='vote_plus'></span>"); //Удаляем кнопки
				vote_container.animate({"marginLeft": "137px"}, "slow").css('marginLeft','137px');
				VoteConteiner.find("#"+CurFotoRating).text("Рейтинг фото: "+Result.find("#PhotoRating").text());	
				$(".highslide-caption #RatingAnkets").each(function(){
					$(this).text("Рейтинг: "+Result.find("#AnketRating").text());
				});
				var AnketRating = Result.find("#AnketRating").text();
				$("#rating_text_content").parent().parent().find("span").remove();
				if(AnketRating > 0) {
					$("#rating_text_content").parent().append("<span id='vote_plus'></span>");
				} else if(AnketRating < 0) {
					$("#rating_text_content").parent().append("<span id='vote_minus'></span>");
				}
				$("#rating_text_content").text(AnketRating);
			}
		}, "html");			
		};
		}
	})
});
$(function(){
	$("#ReloadMainCasting").live('click',function(e){
		e.preventDefault();
		var CHref = $("#ReloadMainCasting");
		var CID = $("#CastingBaner").attr("casting_id");
		$.get("/index.php", {intAjax: 1, event: "getmaincasting", intCastingID: CID}, function(data) {
			$("#CastingMainBlock a").fadeOut(function(){
				$("#CastingMainBlock a").remove();
					var NewCBaner = $(data).find("#OK a").hide();
					NewCBaner.prependTo("#CastingMainBlock").load().fadeIn();				
			});

		}, "html");
	});
});



$(function(){
	$("#ReloadMainVideo").live('click',function(e){
		e.preventDefault();
		$.get("/index.php", {intAjax: 1, event: "getmainvideo", intProfileVideo: 0}, function(data){
			var NewVideo = $(data).find("#OK").hide();
			var OldOBj = $("#OK").hide().remove();
			NewVideo.prependTo("#MainVideoBlok").show();
		}, "html");
	});
});

$(function(){
	$("#ReloadMainImg").live('click',function(e){
		e.preventDefault();
		$.get("/index.php", {intAjax: 1, event: "getmainimg", intProfileVideo: 0}, function(data){
			var Status = $(data).find("#error");
			if(Status.attr("id") == "error") {
				showRegisterSplashWrap('','Войдите или зарегистрируйтесь для дальнейшего просмотра.',0);
			} else {
				var NewIMG = $(data).find("#imgsrc").html();
				var NewIMGName = $(data).find("#imgname").html();
				var CurIMG = $("img#AJMainImg"); 
				CurIMG.fadeOut(function(){
					CurIMG.attr({"src": NewIMG, "name": NewIMGName});
					$("img#AJMainImg").load(function(){
						CurIMG.fadeIn();
					});
				});
			}
		}, "html");
	});
});
/*
function that is similar to php explode
*/
function explode( delimiter, string ) {	// Split a string by string
	// 
	// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	// +   improved by: kenneth
	// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)

	var emptyArray = { 0: '' };

	if ( arguments.length != 2
		|| typeof arguments[0] == 'undefined'
		|| typeof arguments[1] == 'undefined' )
	{
		return null;
	}

	if ( delimiter === ''
		|| delimiter === false
		|| delimiter === null )
	{
		return false;
	}

	if ( typeof delimiter == 'function'
		|| typeof delimiter == 'object'
		|| typeof string == 'function'
		|| typeof string == 'object' )
	{
		return emptyArray;
	}

	if ( delimiter === true ) {
		delimiter = '1';
	}

	return string.toString().split ( delimiter.toString() );
}

/*
	function to generate  facebook like with exact url
	return string;
*/
function likeGenerator(url){
	var picker = '<link rel="image_src" href="'+url+'" />';
	var photoID = explode("/",url);
	console.log(photoID[ photoID.length-1 ]);														//url
	//picker += "<fb:like show-faces='false' action='like' colorscheme='light' href='http://casting.ua/randomPhotoAccess/"+photoID[ photoID.length-1 ]+"' layout='button_count' width='90' autologoutlink='true'></fb:like>";
	picker = "<div style='display : inline; position : absolute'><fb:like show-faces='false' action='like' colorscheme='light' href='http://casting.ua"+url+"' layout='button_count' width='90' autologoutlink='true' ></fb:like></div>";
	picker += '<div style="display : inline; position : absolute; margin-left : 120px"><div id="vk_like" ></div></div><script type="text/javascript">VK.Widgets.Like("vk_like", {type : 10, pageTitle: "Casting.ua", pageDescription: "Фото на Casting.ua", pageUrl : "http://casting.ua'+url+'"});</script>';
	return picker;
}
$(function(){
	$("#AJMainImg").live('click',function(e){
		e.preventDefault();
		
		
		
		var CURIMG = $("#AJMainImg");
		var CURIMGSRC = "/storage/main_photo/"+CURIMG.attr("name"); 																		//http://casting.ua"+CURIMGSRC+"'   
		var BigIMG = $("<div id='ConteinerBigPhoto' style='background-color: #232323; padding: 100px; position: absolute; float: left; border: none !important;'><img src='' id='BigCurIMG' style='border: 2px solid white;'><div id='closed' class='closebutton' style='cursor: pointer;left: 100%; margin-left: -15px; position: absolute; z-index: 99;'></div><div id='nextBT' style='display: none; width: 35px; height: 49px; background: #fff; opacity: 0.7; position: absolute; right: 0px; top: 50%; margin-top: -20px; z-index: 99; cursor: pointer;'><img src='/images/slide_right.png'></div><div id='likeButtons' style=' width:120px; height : 50px; margin-top : 30px; z-index: 99;'></div></div>")
		
		var Img = BigIMG.find("img#BigCurIMG").attr("src", CURIMGSRC);
		// call for make facebook like-buttons appear
		
		//console.log("parseresult"+tmp);

		Img.removeAttr("height", "width");
		var Clouser = BigIMG.find("#closed");
		
		BigIMG.mouseenter(function(){
			$("#nextBT").fadeIn();
		});
		BigIMG.mouseleave(function(){
			$("#nextBT").fadeOut();
		});
		
		Clouser.click(function(){
			$("#shader_blok").add(BigIMG).fadeOut().remove();
			$('object').show();
		});
		
		BigIMG.prependTo("body").hide();
		// last commit
		$("#likeButtons").html(likeGenerator(CURIMGSRC));
		FB.XFBML.parse(document.getElementById("likeButtons"));
		// last commit
		Img.add("#nextBT").click(function(){
			$.get("/index.php", {intAjax: 1, event: "getmainimg", intProfileVideo: 0}, function(BigData){
				var Status = $(BigData).find("#error");
				if(Status.attr("id") == "error") {
					showRegisterSplashWrap('','Войдите или зарегистрируйтесь для дальнейшего просмотра.',0);
				} else {				
					var NewIMG = "/storage/main_photo/"+$(BigData).find("#imgname").html();
					
					BigIMG.fadeOut(function(){
						Img.attr("src", NewIMG);
						//stop begin
						$("#likeButtons").html(likeGenerator(NewIMG));
						FB.XFBML.parse(document.getElementById("likeButtons"));
						//stop end
						Img.removeAttr("height", "width");
						Img.load(function(){
							BigIMG.fadeIn();
						});
					});
				}
				
			}, "html");
		});
		
		Img.load(function(){
		
			/*
				changing facebook meta tags for exact 
			*/
			
			Img.removeAttr("width").removeAttr("height");
			var IMGwidth = Img.attr("width");
			var IMGheight = Img.attr("height");
			
			if (IMGwidth > $(window).width() && IMGheight > $(window).height()) {
				var kw = (IMGwidth - $(window).width())+40;
				IMGwidth = IMGwidth-kw;
				var kh = (IMGheight - $(window).height())+40;
				IMGheight = IMGheight - kh;
			}
			
			if (IMGwidth > $(window).width()) {
				var kw = (IMGwidth - $(window).width())+40;
				IMGwidth = IMGwidth-kw;
				IMGheight = IMGheight - kw;
			}
			
			if (IMGheight > $(window).height()) {
				var kh = (IMGheight - $(window).height())+40;
				IMGheight = IMGheight - kh;
				IMGwidth = IMGwidth-kh;
			}			
			
			Img.attr({width: IMGwidth, height: IMGheight});
			
			IMGwidth = (IMGwidth/2 +100)+'px';
			IMGheight = (IMGheight/2 +100)+'px';
			

			BigIMG.css(
					{"position": "absolute",
					"top": "50%",
					"left": "50%",
					"margin-left": "-"+IMGwidth,
					"margin-top": "-"+IMGheight,
					"z-index": "99"}
				);
			// META tags for likes
			var tmp = $('meta[property="og:image"]').attr("content",'http://casting.ua'+$("#AJMainImg").attr('src'));
			var tmp = $('meta[property="og:url"]').attr("content",'http://casting.ua'+$("#BigCurIMG").attr('src'));
			console.log('meta tag description '+$('meta[property="og:image"]').attr("content"));
			
			BigIMG.fadeIn();
			
		});
		BgShader();
		FB.XFBML.parse(document.getElementById("likeButtons"));
	});
});


$(function(){
	$("#RemindPassword").live('click',function(e){
		e.preventDefault();
		BgShader();
		var RPass = $('<div style="background: #fff; text-align: center; float: left; width: 300px; padding: 20px;">'+
						'<div id="ResultQuery" style="text-align: center; width: 100%; color: #ff0000; text-decoration: blink;"></div>'+
						'<form name="log" method="POST" id="FormRemindPass" action="/remindpass.html">'+
						'<input type="hidden" value="remindpass" name="event">'+				
						'<label class="loginput" for="varEmail" style="text-align: center; width: 100%; margin: 10px 0px 10px 0px; float: left;">Для востановления пароля введите E-mail указаный вами при регистрации.</label>'+
						'<input id="varEmailREM" name="varEmailREM" type="text" style="float: left; width: 180px;">'+
						'<input type="submit" value="Востановить" style="float: right;  width: 100px;">'+
						'</form></div>');
		RPass.prependTo("body");
		var width = RPass.width()/2;
		var height = RPass.height()/2;
		
		RPass.css(
				{"position": "absolute",
				"top": "50%",
				"left": "50%",
				"margin-left": "-"+width+"px",
				"margin-top": "-"+height+"px",
				"border": "5px solid #777",
				"z-index": "99"}
			);
		
		$("#FormRemindPass").live('submit', function(f) {
			f.preventDefault();
			var formStr = $("#FormRemindPass").serialize();
			$.post("/remindpass.html", formStr, function(data){
				var res = $(data);
				var result = res.find("#error");
				if (result.attr("id") != "error") {
					result = res.find("#OK");
					RPass.find("#FormRemindPass").remove();
				} 
				RPass.find("#ResultQuery").html(result.html());
			}, "html");
		});
		
		
		
		
		$("#shader_blok").live('click', function(z) {
			z.preventDefault();
			RPass.remove();
		});
		
	});
});



$(function(){
	$(".add_to_cating a").live('click', function(z) {
			z.preventDefault();
			var UserToCast = $(this);
			var Href = "/performers.html"+UserToCast.attr("href");
			$.post(Href, {intAjax: 1}, function(data){
			var Resul = $(data);
			if(Resul.find("#OK").length){
				$("#ResAddCast").text("Вами отобрано "+Resul.find("#OK").text()+" анкет");
				UserToCast.remove();
			}
		}, "html");
	});
});



function BgShader() {
	var height = $("#wrap").height();
	var blok = $('<div id="shader_blok" style="position: absolute; top: 0px; left: 0px; width: 100%; height: '+height+'px; background: #000000; z-index: 89; opacity: 0;"></div>');
	var flash = $('object');
	flash.hide();
	blok.click(function(){$("#ConteinerBigPhoto").fadeOut(function(){$("#ConteinerBigPhoto").remove()}); blok.animate({opacity: 0}, 500, function(){blok.remove();}); flash.show();});
	blok.prependTo("body").animate({opacity: 0.8}, 500);
	return blok;
};


$(function(){
	$("#ReloadProfileVideo").live('click',function(e){
		e.preventDefault();
		$.get("/index.php", {intAjax: 1, event: "getmainvideo", intProfileVideo: 1}, function(data){
			var NewVideo = $(data).find("#OK").hide();
			var OldOBj = $("#OK").hide().remove();
			NewVideo.prependTo("#ProfileVideoBlok").show();
		}, "html");
	});
});





function hideRegisterSplash(){
	$('embed').each(function(){
		$(this).show();
	});
	$('#splash_wrapper').remove();
	$('#splash_main').remove();
};

function gotoLogin(){
	$('embed').each(function(){
		$(this).show();
	});
	$('#splash_wrapper').remove();
	$('#splash_main').remove();
	$('#ConteinerBigPhoto').remove();
	$('#shader_blok').remove();	
	hs.close();
	$('#login_form_container td').append('<div class="plashka ui-corner-all"></div>');
	$('.plashka').fadeIn('350').fadeOut('350');
	$('#varLogin').focus().attr('value','');

};

function gotoReg(){
	$('embed').each(function(){
		$(this).show();
	});
	$('#splash_wrapper').remove();
	$('#splash_main').remove();
	$('#ConteinerBigPhoto').remove();
	$('#shader_blok').remove();	
	hs.close();
	$('.reg_field').focus();
	open_reg_window();
};

/*
*	@author Uzvikov
*	pop-up default window 	
*	for unregistered users
*
*/
function showRegisterSplash(){
	$('embed').each(function(){
		$(this).hide();
	});
	$('body').append('<div id="splash_wrapper" class="splasher" onclick="hideRegisterSplash();"></div>'+
		'<div id="splash_main" class="splasher">'+
			'<div id="splash_cell">'+
				'<div id="splash_content_border" class="ui-corner-block"></div>'+	
				'<div id="splash_content">'+
					'<div style="border-bottom: 1px solid #dadada;padding-bottom: 3px;margin-bottom: 20px;"><p style="color:#696969; font-size:16px;font-weight:bold;">Сообщение:</p></div>'+
					'<div style="float: right;"><a></div>'+
					'<p style="font-size:14px; line-height: 155%;font-weight:bold;">Уважаемый пользователь!</p>'+
					'<p style="font-size:14px; line-height: 155%;">К сожалению вы не можете проголосовать, потому что не</p>'+
					'<p style="font-size:14px; line-height: 155%;">залогинены или не зарегистрированы на сайте!</p>'+
					'<div style="float: left; font-size:14px; color:#5fad00;margin-top: 25px;"> <a href="#" style="color:#5fad00;" onclick="gotoLogin(); return false;">Войти</a> &nbsp;|&nbsp; <a href="#" style="color:#5fad00;" onclick="gotoReg(); return false;">Зарегистрироваться</a></div></a>'+						
					'<a href="#" onclick="hideRegisterSplash(); return false;"><img src="/images/buttons/yasnenko.png" style="display:block; float:right; margin-top: 25px; width: 95px; height: 22px;"></a>'+				
				'</div>'+
			'</div>'+
		'</div>');
		
		
		$('#splash_wrapper').height($('#wrap').height()+80); // костыль
};
//'К сожалению вы не можете проголосовать, потому что не','залогинены или не зарегистрированы на сайте!'

//wrapper for showRegisterSplash() with two args (strFirst,strSecond)- message body first sentence and second one

function showRegisterSplashWrap(strFirst,strSecond,addPxl){
	$('embed').each(function(){
		$(this).hide();
	});
	$('body').append('<div id="splash_wrapper" class="splasher" onclick="hideRegisterSplash();"></div>'+
		'<div id="splash_main" class="splasher">'+
			'<div id="splash_cell">'+
				'<div id="splash_content_border" class="ui-corner-block"></div>'+	
				'<div id="splash_content">'+
					'<div style="border-bottom: 1px solid #dadada;padding-bottom: 3px;margin-bottom: 20px;"><p style="color:#696969; font-size:16px;font-weight:bold;">Сообщение:</p></div>'+
					'<div style="float: right;"><a></div>'+
					'<p style="font-size:14px; line-height: 155%;font-weight:bold;">Уважаемый пользователь!</p>'+
					'<p style="font-size:14px; line-height: 155%;">'+strFirst+'</p>'+
					'<p style="font-size:14px; line-height: 155%;">'+strSecond+'</p>'+
					'<div style="float: left; font-size:14px; color:#5fad00;margin-top: 25px;"> <a href="#" style="color:#5fad00;" onclick="gotoLogin(); return false;">Войти</a> &nbsp;|&nbsp; <a href="#" style="color:#5fad00;" onclick="gotoReg(); return false;">Зарегистрироваться</a></div></a>'+						
					'<a href="#" onclick="hideRegisterSplash(); return false;"><img src="/images/buttons/yasnenko.png" style="display:block; float:right; margin-top: 25px; width: 95px; height: 22px;"></a>'+				
				'</div>'+
			'</div>'+
		'</div>');
		
		
		$('#splash_wrapper').height($('#wrap').height()+addPxl); // костыль
};


//todo remove  to show message

function TMPshowRegisterSplash(){
	$('embed').each(function(){
		$(this).hide();
	});
	$('body').append('<div id="splash_wrapper" class="splasher" onclick="hideRegisterSplash();"></div>'+
		'<div id="splash_main" class="splasher">'+
			'<div id="splash_cell">'+
				'<div id="splash_content_border" class="ui-corner-block"></div>'+	
				'<div id="splash_content">'+
					'<div style="border-bottom: 1px solid #dadada;padding-bottom: 3px;margin-bottom: 20px;"><p style="color:#696969; font-size:16px;font-weight:bold;">Сообщение:</p></div>'+
					'<div style="float: right;"><a></div>'+
					'<p style="font-size:14px; line-height: 155%;font-weight:bold;">Уважаемый пользователь!</p>'+
					'<p style="font-size:14px; line-height: 155%;">К сожалению вы не можете просмотреть </p>'+
					'<p style="font-size:14px; line-height: 155%;">подробную информацию о кастинге, потому что не</p>'+
					'<p style="font-size:14px; line-height: 155%;">залогинены или не зарегистрированы на сайте!</p>'+
					'<div style="float: left; font-size:14px; color:#5fad00;margin-top: 25px;"> <a href="#" style="color:#5fad00;" onclick="gotoLogin(); return false;">Войти</a> &nbsp;|&nbsp; <a href="#" style="color:#5fad00;" onclick="gotoReg(); return false;">Зарегистрироваться</a></div></a>'+						
					'<a href="#" onclick="hideRegisterSplash(); return false;"><img src="/images/buttons/yasnenko.png" style="display:block; float:right; margin-top: 25px; width: 95px; height: 22px;"></a>'+				
				'</div>'+
			'</div>'+
		'</div>');
		//console.log(height( $(document).height());
		//console.log($("#wrap").height());
		$('#splash_wrapper').height( $("#wrap").height() );
		
};


function closeMessage(){
	$('embed').each(function(){
		$(this).show();
	});
	//$("body").show();
	$('#splash_wrapper').remove();
	$('#splash_main').remove();
};


/*
*	@author Igor
*	function wrapper for function showRegisterSplash()
*	that adds params of message text and type of footer and title
*	
*/
function showMessage(message,type){
	var title	= '';
	var footer	= '';
	switch (type) {
	  case '1':
		title = 'Сообщение';
		footer='<a href="#" onclick="closeMessage(); return false;"><img src="/images/buttons/yasnenko.png" style="display: block;height: 22px;left: 100%;margin-left: -115px;margin-top: -42px;position: absolute;top: 100%;width: 95px;"></a>';
		break;
	  case '2':
		title = 'Новое сообщение:';
		footer='';
		break;
	  case '3':
		title = 'Сообщение:';
		footer='<div style="float: left; font-size:14px; color:#5fad00;margin-top: 51px;"> <a href="/createcasting.html" style="color:#5fad00;">Создать кастинг</a> </div> <a href="#" onclick="closeMessage(); return false;"><img src="/images/buttons/yasnenko.png" style="display: block;height: 22px;left: 100%;margin-left: -115px;margin-top: -42px;position: absolute;top: 100%;width: 95px;"></a>';
		break;		
	};

	$('embed').each(function(){
		$(this).hide();
	});
	$('body').append('<div id="splash_wrapper" class="splasher" onclick="closeMessage();"></div>'+
		'<div id="splash_main" class="splasher">'+
			'<div id="splash_cell">'+
				'<div id="splash_content_border" class="ui-corner-block"></div>'+	
				'<div id="splash_content">'+
					'<div style="border-bottom: 1px solid #dadada;padding-bottom: 3px;margin-bottom: 20px;">'+
						'<p style="color:#696969; font-size:16px;font-weight:bold;">'+
							title+
						'</p>'+
					'</div>'+
					'<div id="show_message_text">'+ 
						message + 
					'</div>'+ 
					footer +
				'</div>'+
			'</div>'+
		'</div>');
};
/**
*	pop-up dialogs for castings template unregistered users
*
*/
$('.black_button_join.AuthRequired').live(	'click', function(e){
								e.preventDefault();
								TMPshowRegisterSplash();
								//showMessage('Зарегистрируйтесь или войдите для того, что бы просмотреть подробную информацию о кастинге.',1)
							});

