$(function(){var menus = ["cont","info","photo","news","link","comment"];$.each( menus , function(){var tag = this;if( $.cookie(tag) == 'false' ){$("#"+tag+"Content").css("display" , "none");};$("#"+tag+"Menu").click(function(){$("#"+tag+"Content").slideToggle(500,function(){var visible = 'true';if( $(this).css("display") == 'none' ){visible = 'false';}$.cookie( tag ,visible ,{ expires: 2 });});});});$(".menuTitle").hover(titleToggle, titleToggle);});function titleToggle(){$(this).toggleClass("menuTitleHover");}$(function(){$.ajax({ url : baseurl + "externalapi/getphoto/" + country ,type : "GET",success : function(data){$( data ).each(function(){setPhoto($(this).attr("src"));});},error : function( xhr , stat ){}});});function setPhoto( url ){var img = new Image();$(img).load(function () {$(this).hide();$('#photoContent .holder').append(this);$(this).fadeIn(1000);}).attr('border', '0' ).attr('src', url );}$(function(){$(".ddMenu li").hover(function(){$(this).find("ul").fadeIn("slow");},function(){$(this).find("ul").css("display","none");});$("#langSelect li ul li a").each(function(){if($(this).attr("href")== currentUrl ) $(this).remove();});});$(function(){loadComments( false );$("#commentContent #resetButton" ).click(function(){resetInputText();});$("#commentContent #sendButton" ).click(function(){showLoadingInfo();var params = { "data[Comment][country_id]":countryId ,"data[Comment][username]": $("#commentContent #userName" ).attr("value") ,"data[Comment][text]":  $("#commentContent textarea" ).val(),"data[Comment][language]":$("#userLang").children(':selected').attr("val")};$.post( baseurl + "comments/sendcomments", params , function(data){loadComments( true );});});$.each( langset , function(){$("#userLang, .fromLang, .toLang").append("<option val='"+this.val+"' >"+this.ln+"</option>");});$("#userLang option").each( function(){var userLang = $(this).attr("val");if((navigator.language&&navigator.language.indexOf(userLang)>-1)||(navigator.browserLanguage&&navigator.browserLanguage.indexOf(userLang)>-1)){$(this).attr("selected", "selected");}});});function loadComments( noCache , page ){var cachekiller = noCache ? "?"+ new Date().getTime() : "";if( page == undefined ) page = 1;$("#commentContent .holder").load( baseurl + "contentapi/getcomments/" + countryId + "/" + page + cachekiller , function(){$( this ).find(".pagenation").click(function(){showLoadingInfo();loadComments( true , $(this).text() );}).each(function(){if( $( this ).text() == page ){$( this ).addClass("pagenationOff").unbind("click");}});$(this).find(".comment").each(function(){$(this).find(".info").prepend( "<span class='translate'>" + $(".transSend").text() +"</span>" ).parent().find(".translate").click(function(){showTransBox( $(this).parent().parent() , $(this).parent().parent().find(".text").attr("rel") );});});resetInputText();});}function showLoadingInfo(){$("#commentContent .holder").html( "Loading..." );}function resetInputText(){$("#commentContent textarea" ).val("");}function showTransBox( listCol , lang ){if( listCol.find( ".translateBox" ).get(0)) return;var box = listCol.append( $("#transBox").clone().css("display","block").attr("id",""));box.find(".fromLang option").each( function(){if($(this).attr("val") == lang ){$(this).attr("selected", "selected");}});box.find(".toLang option").each( function(){var userLang = $(this).attr("val");if((navigator.language&&navigator.language.indexOf(userLang)>-1)||(navigator.browserLanguage&&navigator.browserLanguage.indexOf(userLang)>-1)){$(this).attr("selected", "selected");}});box.find(".transSend").click(function(){translate( $(this).parent(),box.find(".fromLang").children(':selected').attr("val") ,box.find(".toLang").children(':selected').attr("val") ,$(this).parent().parent().parent().find(".text").text() );});box.find(".transClose").click(function(){$(this).parent().remove();});}function translate( dom , from , to , text ){$.ajax({ url : 'http://ajax.googleapis.com/ajax/services/language/translate',type : "GET",data: { v: '1.0', q: text, langpair: from + "|" + to},dataType: 'jsonp',success : function(data){dom.append("<div>" + data.responseData.translatedText +" [ "+ from + "-&gt;" + to + "]</div>");},error : function(){}});}$(function(){( mapmode == 'history' )? $(".subRight .hMapMenu").hide() : $(".subRight .cMapMenu").hide();$(".subRight .cMapMenu").click(function(){$(this).hide();$(".subRight .hMapMenu").show();mapControl.showControl();});$(".subRight .hMapMenu").click(function(){$(this).hide();$(".subRight .cMapMenu").show();mapControl.showHistory();});});