$(document).ready(function(){$.isShift=false;$(document).keyup(function(e){if(e.which==16){$.isShift=false;}}).keydown(function(e){if(e.which==16){$.isShift=true;}});$(".show-on-ready").show();try{var mm_pos=$("#menu_frame").position().left;var cur_pos=$("#menu_frame .mm_elem:has(.current)").position().left;var cur_width=$("#menu_frame .mm_elem:has(.current)").width();if(mm_pos>0&&cur_pos>0&&cur_width>0){$("#big_path .big_path_content").css("background-position",(-960+(cur_pos-mm_pos+cur_width/2))+"px");}}catch(e){}if(jQuery().inFieldLabels){$("label").removeClass("hidden");$("label").inFieldLabels();setTimeout(function(){if($("#header_login .input_text #y_username").val()){$("#header_login .input_text #y_username").trigger("keydown");}if($("#header_login .input_text #y_password").val()){$("#header_login .input_text #y_password").trigger("keydown");}},1000);}$(".no_autocomplete input").attr("autocomplete","off");$(".mm_elem").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("sel");},function(){$(this).removeClass("sel");});$("#subsub_menu .subsub_elem").click(function(){document.location.href=$(this).find("a").attr("href");}).hover(function(){$(this).addClass("on_hover");},function(){$(this).removeClass("on_hover");});$(".sbutton").mouseleave(function(){$(this).removeClass("sbutton_down");}).mousedown(function(){$(this).addClass("sbutton_down");});$(".sbutton_red").mouseleave(function(){$(this).removeClass("sbutton_red_down");}).mousedown(function(){$(this).addClass("sbutton_red_down");});$(".jbutton").mouseleave(function(){$(this).removeClass("jbutton_down");}).mousedown(function(){$(this).addClass("jbutton_down");});$(".fbutton").mouseleave(function(){$(this).removeClass("fbutton_down");}).mousedown(function(){$(this).addClass("fbutton_down");});$(".search-input-box").after('<img class="search-input-box-reset" src="/img/icon-cancel-grey.gif" />');$(".search-input-box-reset").click(function(){$(this).prev(".search-input-box").val("").focus().trigger("keyup");});$("#search-in-friends").keyup(function(){var searchFor=$.trim($(this).val().toLowerCase());if(searchFor==""){$(this).next(".search-input-box-reset").hide();try{if($("#filter-common-friends").attr("checked")){$(".white-content-box #friend-list .galleryBlock").hide();$('.white-content-box #friend-list .galleryBlock:has(.commonfriend:contains("1"))').show();}else{$(".white-content-box #friend-list .galleryBlock").show();}}catch(e){}}else{$(this).next(".search-input-box-reset").show();$(".white-content-box #friend-list .galleryBlock").hide();try{if($("#filter-common-friends").attr("checked")){$(".white-content-box #friend-list .galleryBlock:has(.fullname:contains('"+searchFor+"')):has(.commonfriend:contains('1'))").show();}else{$(".white-content-box #friend-list .galleryBlock:has(.fullname:contains('"+searchFor+"'))").show();}}catch(e){}}});$("#filter-common-friends").change(function(){$("#search-in-friends").trigger("keyup");});$(".button").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("sel");},function(){$(this).removeClass("sel");});$(".arrow_left").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("arrow_sel_l");},function(){$(this).removeClass("arrow_sel_l");});$(".arrow_right").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("arrow_sel_r");},function(){$(this).removeClass("arrow_sel_r");});$(".page").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel");},function(){$(this).removeClass("block_sel");});$(".page_next").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel");},function(){$(this).removeClass("block_sel");});$(".page_back").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel");},function(){$(this).removeClass("block_sel");});$(".page_small").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel_small");},function(){$(this).removeClass("block_sel_small");});$(".page_next_small").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel_small");},function(){$(this).removeClass("block_sel_small");});$(".page_back_small").click(function(){document.location.href=$(this).children("a").attr("href");}).hover(function(){$(this).addClass("block_sel_small");},function(){$(this).removeClass("block_sel_small");});$(".input_text,.input_password").hover(function(){$(this).addClass("input_text_hover");},function(){$(this).removeClass("input_text_hover");});$(".resizable:not(.processed)").TextAreaResizer();$(".tooltip").tooltip({showBody:" :: ",showURL:false,track:true});$("#profile_menu").hover(function(){$(this).stop().animate({"height":"230px"},100).css("border-color","#333");},function(){$(this).stop().animate({"height":"30px"},0).css("border-color","#bdbcbd");});$("#filter_results_open").click(function(){$("#filter_results_open").hide();$("#filter_results_close").show();$("#filter_box").stop().animate({height:"400px"});});$("#filter_results_close").click(function(){$("#filter_results_close").hide();$("#filter_results_open").show();$("#filter_box").stop().animate({height:"20px"});});$("#open-page-loader").click(function(){$(this).after('<div id="page-loader"><div id="page-loader-box"><img src="/img/loader-anim.gif"/></div></div>');return false;});$(".form-section-header").click(function(){secId=$(this).children("input").val();try{openIt=true;if($("#form-section-"+secId).is(".visible")){openIt=false;}$(".form-section").hide().removeClass("visible");$(".form-section-header .icon-expand").show();$(".form-section-header .icon-collapse").hide();if(openIt){$(this).find(".icon-expand").hide();$(this).find(".icon-collapse").show();$("#form-section-"+secId).fadeIn().addClass("visible");$("#submit-buttons").empty().append($("#form-section-"+secId+" :submit").clone());}}catch(e){}});if($("#open-section").length){secId=$("#open-section").val();try{$("#form-section-header-"+secId).trigger("click");}catch(e){$("#form-section-header-1").trigger("click");}}$("#add_category").click(function(event){var category=$("#input_add_category").attr("value");if(category==null){category="";}$.post("/ajax/add_category",{"category":category},function(response){var respArr=response.split(";;;");$("#add_category_msg").html(respArr[1]).stop().stop().stop().animate({opacity:1},500).animate({opacity:1},5000).animate({opacity:0},3000);if(parseInt(respArr[0])>0){category=respArr[2];$("#category_list").prepend('<input class="input_checkbox" type="checkbox" value="'+respArr[0]+'" checked="checked" onchange="selectCategory(this.value, this.checked);" />'+category+"<br />");selectCategory(respArr[0],true);}});});$("#explore_add_now").click(function(){document.location.href=$(this).find("a").attr("href");});$("#set_lang").change(function(){$("#signup_form").attr("action","http://"+$("#set_lang").val()+"."+$("#ydomain").val()+"/signup");});$("#onClickGoto").change(function(){if($("select option:selected").attr("title")!=""){document.location.href=$("select option:selected").attr("title");}});$(".align_v").vAlign();if($("#in_tabs").length>0){$("#in_tabs").tabs({fxAutoHeight:false,onShow:switchedTabAction});}$(".statusQuestion").click(function(){$("#statusInput").focus();$(this).css("display","none");$("#statusInput").css("display","block").css("border","none");$("#statusInput").focus();$(".statusButton").fadeIn("slow");});$("#statusButtonButton").click(function(){var status=$.trim($("#statusInput").val());if(status==""){$("#statusError").stop().stop().stop().slideDown().animate({opacity:1},5000).slideUp();$("#statusInput").focus();}else{$("#statusButtonBox").hide();$("#statusButtonLoader").show();$.post("/ajax/write_status",{"status":status},function(response){window.location.reload();});}return false;});$("#statusInput").keypress(function(e){if(e.which==13){$("#statusButtonButton").trigger("click");}});bindCommentQuestionClick();bindCommentEnterButton();});$.extend({ylog:function(t){if(window.console&&window.console.firebug){console.log(t);}}});$.extend({URLEncode:function(c){var o="";var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;while(x<c.length){var m=r.exec(c.substr(x));if(m!=null&&m.length>1&&m[1]!=""){o+=m[1];x+=m[1].length;}else{if(c[x]==" "){o+="+";}else{var d=c.charCodeAt(x);var h=d.toString(16);o+="%"+(h.length<2?"0":"")+h.toUpperCase();}x++;}}return o;},URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;while((m=r.exec(o))!=null&&m.length>1&&m[1]!=""){b=parseInt(m[1].substr(1),16);t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}});function bindCommentEnterButton(){$(".commentInput").keypress(function(e){try{id=$(this).attr("id");arr=id.split("_");if(e.which==13){clickActionLogCommentButton(arr[1]);}}catch(e){}});}function bindCommentQuestionClick(){$(".commentQuestion").click(function(){try{id=$(this).attr("id");arr=id.split("_");$("#commentInput_"+arr[1]).focus();$(this).css("display","none");$("#commentInput_"+arr[1]).css("display","block").css("border","none");$("#commentInput_"+arr[1]).focus();}catch(e){}});}function clickActionLogCommentButton(log_id){var comment=$.trim($("#commentInput_"+log_id).val());if(comment==""){$("#commentError_"+log_id).stop().stop().stop().slideDown().animate({opacity:1},5000).slideUp();$("#commentInput_"+log_id).focus();}else{$("#commentButtonBox_"+log_id).hide();$("#commentButtonLoader_"+log_id).show();$.post("/ajax/write_action_log_comment",{"log_id":log_id,"comment":comment},function(response){$("#action-log-comment-box_"+log_id).before(response);$("#commentInput_"+log_id).val("");$("#commentButtonLoader_"+log_id).hide();$("#commentButtonBox_"+log_id).show();});}return false;}function switchedTabAction(clicked,toShow,toHide){tab=clicked.hash;if(tab){if($(tab+"_result").html()=="..."){$(tab+"_result").load("/ajax/fetch_action_log",{"log_name":tab},function(){$(tab+"_loader_code").slideUp("slow",function(){$(tab+"_result").slideDown("slow");});bindCommentQuestionClick();bindCommentEnterButton();});}}}function fetchNextActionLogs(log_name,history_level,last_action_time,history_crc){$("#"+log_name+"_result_"+history_level).fadeOut();$("#"+log_name+"_loader_code").slideDown();$.post("/ajax/fetch_action_log",{"last_action_time":last_action_time,"log_name":"#"+log_name,"history_level":history_level,"history_crc":history_crc},function(response){$("#"+log_name+"_loader_code").slideUp("slow",function(){$("#"+log_name+"_result_"+history_level).replaceWith(response);bindCommentQuestionClick();bindCommentEnterButton();});});}(function($){$.fn.vAlign=function(){return this.each(function(i){var th=$(this).height();var ph=$(this).parent().height();var mh=(ph-th)/2;$(this).css("margin-top",mh);});};})(jQuery);(function($){$.fn.hAlign=function(){return this.each(function(i){var tw=$(this).width();var pw=$(this).parent().width();var mw=(pw-tw)/2;$(this).css("float","none").css("margin-left",mw+"px").css("margin-right",mw+"px");});};})(jQuery);function updateValue(field,value){$(field).attr("value",value);}function selectCategory(category_id,checked){var catFieldName="set_category_"+category_id;var catField=$("#"+catFieldName);if(catField["0"]){catField.attr("value",(checked)?"1":"0");}else{$("#write_post_form").prepend('<input name="'+catFieldName+'" type="hidden" value="'+((checked)?"1":"0")+'" id="'+catFieldName+'" />');}}jQuery.updateSession=function(name,value){jQuery.post("/ajax/session",{"name":name,"value":value},function(response){});};function confirm(message,callback,stayOnPage){$("#confirm").modal({close:false,overlayId:"confirmModalOverlay",containerId:"confirmModalContainer",onShow:function(dialog){dialog.data.find(".message").append(message);dialog.data.find(".yes").click(function(){if($.isFunction(callback)){callback.apply();}else{if(stayOnPage){$.post(callback,{},function(response){window.location.reload();});}else{document.location.href=callback;}}$.modal.close();});}});}function confirmInfo(message,callback){$("#confirmInfo").modal({close:false,overlayId:"confirmModalOverlay",containerId:"confirmModalContainer",onShow:function(dialog){dialog.data.find(".message").append(message);dialog.data.find(".yes").click(function(){if($.isFunction(callback)){callback.apply();}else{document.location.href=callback;}$.modal.close();});}});}function postAndReload(url){$.post(url,{"skipRedirect":"1"},function(response){window.location.reload();});}function sendReport(reason_elem,report_button_box,loader,result_box,report_auid,pid,pu){$("#"+report_button_box).hide();$("#"+loader).slideDown();$.post("/ajax/a_report_abuse",{"report_auid":report_auid,"pid":pid,"pu":pu,"reason":$("#"+reason_elem).val()},function(response){var respArr=response.split(";;;");$("#"+result_box).html(response);$("#"+result_box).show();$("#"+result_box).html(respArr[1]).stop().stop().stop().animate({opacity:1},500);if(parseInt(respArr[0])==1){$("#"+loader).slideUp();}else{$("#"+loader).slideUp();$("#"+report_button_box).show();}});}function printLangSelector(y_lang,request_uri,lang_name,request_uri2,ch_lang){try{var lang_select_code=' 	<span class="current_lang dropdown_lang"> 		<a class="languages_flag languages_flag_'+y_lang+'" href="/redir.php?lang='+y_lang+"&url="+request_uri+'"></a> 		<a id="cur_lang" href="/redir.php?lang='+y_lang+"&url="+request_uri+'">'+lang_name+'</a><i>&nbsp;</i> 	</span> 	<!--[if lt IE 7]> 		<a class="languages_flag languages_flag_'+y_lang+'" href="/redir.php?lang='+y_lang+"&url="+request_uri2+'"></a> 		<a id="cur_lang_ie" href="/redir.php?lang='+y_lang+"&url="+request_uri2+'">'+lang_name+'<i>&nbsp;</i> 		<table><tr><td> 	<![endif]-->  	<ul id="select_lang"> 		<li> 			<a class="languages_flag languages_flag_'+y_lang+'" href="/redir.php?lang='+y_lang+"&url="+request_uri+'"></a> 			<a href="/redir.php?lang='+y_lang+"&url="+request_uri+'">'+lang_name+"</a><i>&nbsp;</i> 		</li>";for(var i=0;i<ch_lang.length;i=i+2){lang_select_code=lang_select_code+' 			<li> 				<a class="languages_flag languages_flag_'+ch_lang[i]+'" href="/redir.php?lang='+ch_lang[i]+"&url="+request_uri+'"></a> 				<a href="/redir.php?lang='+ch_lang[i]+"&url="+request_uri+'">'+ch_lang[i+1]+"</a> 			</li>";}lang_select_code=lang_select_code+" 	</ul>  	<!--[if lt IE 7]></td></tr></table></a><![endif]-->";$("#switch_lang").html(lang_select_code);}catch(e){}}