﻿/*function reScroll(obj,sayfayaWOran,sayfayaHOran,alanWidth,alanHeight) {
    if (sayfayaWOran > 0) {
        var genislik = $("#divAnaCerceve").width();
        var yukseklik = $("#divAnaCerceve").height();
        if (genislik < 800) newWidht = 800 * sayfayaWOran; else newWidht = genislik * sayfayaWOran;
        if (yukseklik < 400) newHeight = 400 * sayfayaHOran; else newHeight = yukseklik * sayfayaHOran;
    } else {
        newWidht = alanWidth;
        newHeight = alanHeight;
    }

    if ($('.jScrollPaneContainer')) { var x = $('#' + obj).html(); $("#divIcerikX").html("<div id=\"" + obj + "\">" + x + "</div>"); }
    $('#divIcerik').width(Math.ceil(newWidht) + "px");
    $('#divIcerik').height(Math.ceil(newHeight) + "px");

    $('#divIcerikX').width(Math.ceil(newWidht) + "px");
    $('#divIcerikX').height(Math.ceil(newHeight) + "px");

    $('#' + obj).jScrollPane({ showArrows: false });
    if ($('.jScrollPaneTrack').width() != 10) { $('#' + obj).width(($('.jScrollPaneContainer').width()) + "px"); }
}*/


function reScroll(obj, sayfayaWOran, sayfayaHOran, alanWidth, alanHeight) {
    if (sayfayaWOran > 0) {
        var genislik = $("#divAnaCerceve").width();
        var yukseklik = $("#divAnaCerceve").height();
        if (genislik < 800) newWidht = 800 * sayfayaWOran; else newWidht = genislik * sayfayaWOran;
        if (yukseklik < 400) newHeight = 400 * sayfayaHOran; else newHeight = yukseklik * sayfayaHOran;
    } else {
        newWidht = alanWidth;
        newHeight = alanHeight;
    }
    if ($('.jScrollPaneContainer')) { var x = $('#' + obj).html(); $("#divIcerikX").html("<div id=\"" + obj + "\" style=\"height:" + newHeight + "px;\">" + x + "</div>"); }
    $('#divIcerik').width(Math.ceil(newWidht) + "px");
    $('#divIcerik').height(Math.ceil(newHeight) + "px");

    $('#divIcerikX').width(Math.ceil(newWidht) + "px");
    $('#divIcerikX').height(Math.ceil(newHeight) + "px");

    $('#' + obj).jScrollPane({ showArrows: false });
    if ($('.jScrollPaneTrack').width() != 10) { $('#' + obj).width(($('.jScrollPaneContainer').width()) + "px"); }
}


function menuSec(nesneId) {
    $("a[id^='amenu']").removeClass();
    if (nesneId != "amenu8") {
        $("#" + nesneId).addClass("standartActive");
    } else { $("#" + nesneId).addClass("eshopActive"); }
}
function ozelScroll(nesneId) {
    $('#' + nesneId).jScrollPane({ showArrows: false });
}

function bgYukle(url) {
    $("#showProduct1").attr("src", url);
}

function gorunum(icerik) {
    obje = $("#" + icerik);
    var genislik = obje.width();
    var yukseklik = obje.height();
    if (genislik > 900) { genislik = 900; } else if (genislik < 300) {genislik = 300;}
    if (yukseklik > 600) { yukseklik = 600; } else if (yukseklik < 250) {yukseklik = 250;}

    window.resizeTo(genislik, yukseklik);
    var ypos = Math.ceil(($(top.window).height() - window.top.$('#facebox').height()) / 2);
    var xpos = Math.ceil(($(top.window).width() - window.top.$('#facebox').width()) / 2);
    window.top.$('#facebox').css('top', ypos + "px"); 
    window.top.$('#facebox').css('left',xpos+"px"); 
}

function sayfaYukle(alan, sayfa, queryS) {
    if (queryS != '')
        $("#" + alan).load(sayfa + "?" + queryS);
    else
        $("#" + alan).load(sayfa);
}
function formBayi() {
    window.open("formBayi.aspx", "yeniPen", "scrollbars=yes,height=650,width=700,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes");
}

function formFr() {
    window.open("formFr.aspx", "yeniPen", "scrollbars=yes,height=650,width=700,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes");
}

function haberFr() {
    top.location.href = 'frHaber.aspx';
}
function frHaberPopup(id) {
    $.facebox("<iframe src='frHaberDetay.aspx?id=" + id + "' name='popup' frameborder='0' width='400' height='300' scrolling='auto'></iframe>");
}
function haberPopup(id) {
    $.facebox("<iframe src='haberDetay.aspx?id=" + id + "' name='popup' frameborder='0' width='600' height='300' scrolling='auto'></iframe>");
    return false;
}

function haritaYukle(id) {
    document.getElementById("krokiFrame").src = "kroki.aspx?id=" + id;
    $("div[id^=link]").removeClass("magazaKutu1Active");
    $("#link" + id).addClass("magazaKutu1Active");
}

function haritaYukle2(id) {
    $.facebox("<iframe src='kroki.aspx?id=" + id+"' name='popup' frameborder='0' width='540' height='400' scrolling='auto'></iframe>");
}


function getAllMessage(id,userCult) {
    $.ajax({
        type: "POST",
        url: "./xhr/sr_islem.ashx",
        cache: false,
        data: { 'pid': id, 'w': $(window).width(), 'uc': userCult },
        contentType: "application/x-www-form-urlencoded; charset=utf-8",
        dataType: "html",
        beforeSend: function (xhr) { },
        success: function (msg, path) {
            jQuery("#divLoading").attr('style', 'display:none');
            var obj = jQuery.parseJSON(msg);
            //alert($("#showProduct1").attr("src") + " !=" + obj.bresim);
            //$("#showProduct1").attr("src")
            if ($("#showProduct1").attr("src") != obj.bresim) {
                urunLoading(obj.bresim);
                jQuery("#divDataAlan").html(obj.fiyat);
                $("div[id^=show]").removeClass("thumbKutuActive");
                $("#show" + id).addClass("thumbKutuActive");
				if (id == 45) 
				{ 	
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-739-Dantel-Detayli-Hamile-Atleti-Lonna.html'); 	
				}
				else if (id == 44)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-761-T-shirt-Cannes.html'); 	
				}
				else if (id == 40)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-759-Genis-Pacali-Pantolon-Ines.html'); 		
				}
				else if (id == 20)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-754-Hamile-Etek-Minelli.html'); 	
				}
				else if (id == 30) 
				{ 	
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-751-Bluz-Bella.html'); 		
				}
				else if (id == 21)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-756-Hamile-Elbisesi-Ramona.html'); 	
				}
				else if (id == 33)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-738-Kollari-Buzgulu-Bluz-Elenora.html'); 	
				}
				else if (id == 28)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-744-Hamile-Elbisesi-Philippa.html'); 	
				}
				else if (id == 27) 
				{ 	
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-749-Hamile-Bluzu-Renee.html'); 		
				}
				else if (id == 13)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-766-T-shirt-Paint.html'); 	
				}
				else if (id == 36)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-764-T-shirt-Book.html'); 	
				}
				else if (id == 39)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-763-Hamile-T-shirt-Ballerina.html'); 	
				}
				else if (id == 54)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-758-Hamile-Denim-Letya.html'); 	
				}
				else if (id == 49)
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com/?urun-746-Dar-Kesimli-Kot-Pantolon-Kacy.html'); 		
				}
				else 
				{
					$("#bgglink1").attr('href', 'http://www.e-gebe.com'); 		
				}
                /*if (obj.ileriId == 0)
                jQuery("#divButonIleri").html('');
                else
                jQuery("#divButonIleri").html('<a href=\"javascript:getAllMessage(' + obj.ileriId + ');\"><img src=\"images/butonIleri.png\" width=\"26\" height=\"39\" alt=\"\"/></a>');

                if (obj.geriId == 0)
                jQuery("#divButonGeri").html('');
                else
                jQuery("#divButonGeri").html('<a href=\"javascript:getAllMessage(' + obj.geriId + ');\"><img src=\"images/butonGeri.png\" width=\"26\" height=\"39\" alt=\"\"/></a>');*/
                jQuery("#divKontroller").attr('style', 'display:visible');
            }
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(textStatus);
        }
    });
}

function getTrend(id,userCult) {
    $.ajax({
        type: "POST",
        url: "./xhr/sr_islem.ashx",
        cache: false,
        data: { 'tid': id, 'w': $(window).width(),'uc': userCult},
        contentType: "application/x-www-form-urlencoded; charset=utf-8",
        dataType: "html",
        beforeSend: function (xhr) { },
        success: function (msg, path) {
            var obj = jQuery.parseJSON(msg);
            $("#showTrendImg").attr("src", obj.bgresim);
            $("#showTrendImg").css('display', 'block');
            jQuery("#divIcerikYazi").html(obj.data);
            reScroll('divIcerikYazi', 0, 0, 560, 210);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
        }
    });
}

function getIsortak(cod, userCult) {
    $.ajax({
        type: "POST",
        url: "./xhr/sr_islem.ashx",
        cache: false,
        data: { 'code': cod,'uc': userCult },
        contentType: "application/x-www-form-urlencoded; charset=utf-8",
        dataType: "html",
        beforeSend: function (xhr) { },
        success: function (msg, path) {
            var obj = jQuery.parseJSON(msg);
            jQuery("#divIcerikYazi").html(obj.data);
            reScroll('divIcerikYazi', 0.4, 0.3, 0, 0);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
        }
    });
}


