$(document).ready(function(){

 $(".topNav li").hover(function(){
   $('ul',this).css('visibility', 'visible');
 },function(){
   $('ul',this).css('visibility', 'hidden');
 });

});



$(document).ready(function(){
						   
	var sldcount = $("#sld").children("a.sld-item").size() - 1;
	var active = 0;
	var interval;
	function changeItem(){
		findActive();
		if(active == sldcount){
			$("#sld").children("a.sld-item").eq(active).fadeOut(700);
			$("#sld").children("a.sld-item").eq(active).removeClass("active");
			$("#sld").children("a.sld-item").eq(0).fadeIn(700);
			$("#sld").children("a.sld-item").eq(0).addClass("active");
		}
		else{
			$("#sld").children("a.sld-item").eq(active).fadeOut(700);
			$("#sld").children("a.sld-item").eq(active).removeClass("active");
			$("#sld").children("a.sld-item").eq(active + 1).fadeIn(700);
			$("#sld").children("a.sld-item").eq(active + 1).addClass("active");
		}
	}
	function findActive(){
		$("#sld").children("a.sld-item").each(function(i){
			if($(this).hasClass("active")){
				active = i;
				return false;
			}
		});
	}
	interval = setInterval(changeItem, 5000);
});


function GetNews(GID,Gthis){

if (LastID != null) {
    $("#NT_" + LastID).removeClass("current");
}
    $("#NT_" + GID).addClass("current");

if (LastID != null) {
    $("#News_" + LastID).hide(500, function() {
        $("#News_" + GID).show(500);
    });
}else{
	$("#News_" + GID).show(500);
}

LastID=GID;
}


function GetMaps(GName) {

    $("body").prepend("<div id='contactMap'></div>");

    if (GName == "Turkey") {
        $("#contactMap").html("<img src='/images/map_turkey.jpg' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='789,5,863,31' href=\"javascript:mapClose();\" /><area shape='rect' coords='808,419,871,447' href=\"javascript:mapPrint('MapTurkey');\" />");
    } else if(GName == "MoscowRU") {
        $("#contactMap").html("<img src='/images/map_moscowRU.jpg' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='789,5,863,31' href=\"javascript:mapClose();\" /><area shape='rect' coords='808,419,871,447' href=\"javascript:mapPrint('MapMoscowRU');\" />");
    } else if(GName == "TurkeyRU") {
        $("#contactMap").html("<img src='/images/map_turkeyRU.jpg' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='789,5,863,31' href=\"javascript:mapClose();\" /><area shape='rect' coords='808,419,871,447' href=\"javascript:mapPrint('MapTurkeyRU');\" />");
    }else {
        $("#contactMap").html("<img src='/images/map_moscow.jpg' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='789,5,863,31' href=\"javascript:mapClose();\" /><area shape='rect' coords='808,419,871,447' href=\"javascript:mapPrint('MapMoscow');\" />");
    }


    MapLeft = ($("body").width() - 900) / 2;
    $("#contactMap").css("left", (MapLeft) + "px");
    
    
}

function mapClose() {
    $("#contactMap").remove();
}

function mapPrint(GName) {
    window.open("/"+GName + ".html", "Sinerji", "width=880,height=460");
}

function PrintAndClose() {
    window.print();
    window.close();
}

LastID = null;
LastThis = null;
function Accordion(GID, Gthis) {

    if (LastID != null) {
        $(LastThis).parent().removeClass("current");
        $("#A_" + LastID).hide(500);
    }

    $(Gthis).parent().addClass("current");
    $("#A_" + GID).show(500);

    LastID = GID;
    LastThis = Gthis;
}

function OnSearch(keyw) {
    var k = document.getElementById(keyw);
    location.href = "Search.aspx?Keyword=" + encodeURI(k.value);
    return false;
}

function CheckEnter(e) {
    var keynum;
    var keychar;
    var numcheck;

    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if (keynum == 13) {
        OnSearch("_top1_ucSearch1_Keyword");
        return false;
    }
    else
        return true;
    //keychar = String.fromCharCode(keynum);
    //alert(keychar);
    //numcheck = /\d/;
    //return !numcheck.test(keychar);
}
