﻿prev = "";
var durum=0;
function show(no) {

    if (prev == "") {
        $("#" + no).animate({ height: '280px', width: '550px' }, function () {
            $("#img" + no).show("slow");
            $("#img" + no).fadeIn("slow");
        });
        
        prev = no;
    }
    else if (prev != "" && no!=prev) {
        $("#img" + prev).hide("fast");
        $("#" + prev).animate({ height: '180px', width: '180px' });
            
        
        $("#" + no).animate({ height: '280px', width: '550px' }, function () {
            $("#img" + no).show("slow");
            $("#img" + no).fadeIn("slow");
        });

        prev = no;

    }
    else {
        if (durum==0) {
            $("#img" + prev).hide("slow");
            $("#" + prev).animate({ height: '180px', width: '180px' });
            durum = 1;
        }
        else {
            $("#" + no).animate({ height: '280px', width: '550px' }, function () {
                $("#img" + no).show("slow");
                $("#img" + no).fadeIn("slow");
            });
            durum = 0;
            prev = no;

        }
        
    }
    if (no == 1) {
        $("#2td").attr("valign", "bottom");
        $("#3td").attr("align", "right");

    }
    else if (no == 3) {
        $("#1td").attr("align", "right");
        $("#4td").attr("valign", "top");
    }
    else if (no == 2) {
        $("#1td").attr("valign", "bottom");
    }
    else if (no == 4) {
        $("#3td").attr("valign", "top");
    }
    prev = no;
}
function getPage(no, param, sayfa) {
    show(no);
    $("#bg").animate({ 'margin-left': -1000 });
    if (param!="") {
        pageLoad(param,sayfa);
    }
    else {
        pageLoad(sayfa,'');
    }

}
function pageLoad(prm,syf) {
    $("#bg").animate({ 'margin-left': -1000 });
    $.ajax({
        type: 'GET',
        url: prm + '/default.aspx',
        success: function (msg) {
            $("#detay").html(msg);
        },
        error: function () {
            getPageParam(syf);
        },
        start: function () { $("#detay").html("yükleniyor"); }
    });
}
function getPageParam(page) {
    var u = window.location.hash;
    u = u.replace('#', '');
    u = u.replace('-', '');

    $("#bg").animate({ 'margin-left': -1000 });
    $.ajax({
        type: 'GET',
        url: page + '/default.aspx',
        data: 'p=' + u,
        success: function (msg) {
            $("#detay").html(msg);
        },
        error: function () {
        },
        start: function () { $("#detay").html("yükleniyor"); }
    });
}
function getAnasayfa() {
    $("#bg").animate({ 'margin-left': 0 });
}
function videoPlayer() {
    jwplayer('mediaspace').setup({
        'flashplayer': 'Scripts/player.swf',
        'file': 'resource/59227978.flv',
        'autostart': 'true',
        'stretching': 'fill',
        'controlbar': 'none',
        'width': $(window).width(),
        'height': ($(window).height() + 100)
    });
}
function goU(l) {
    parent.window.open("http://" + l, "_blank");
}
