﻿// ortalanmış pencere açımı
var w = 800, h = 600;

if (document.all || document.layers) {
   w = screen.availWidth;
   h = screen.availHeight;
}

function openPopup(theURL,winName,popupLocation) { //v2.0

Width = 400;Height = 400;

switch (popupLocation)
{
    case "popup_taksit": Width = 600;Height = 500;break;
    case "popup_favori": Width = 460;Height = 330;break;
    case "popup_fiyat": Width = 460;Height = 330;break;
    case "popup_oner": Width = 460;Height = 330;break;
    case "popup_stokHaberci": Width = 450;Height = 330;break;
    case "popup_yorum": Width = 550;Height = 330;break;
    case "popup_satissozlesmesi": Width = 770;Height = 600;break;
    case "kargo_pencere": Width = 760;Height = 500;break;
    case "popup_security": Width = 800;Height = 590;break;
    case "popup_ipucu": Width = 800;Height = 600;break;     
    case "popup_yorumOku": Width = 800;Height = 600;break;
    case "popup_yorumEkle": Width = 550;Height = 320;break;
    case "popup_faturaDetay": Width = 650;Height = 550;break;
    case "popup_promosyon": Width = 620;Height = 400;break;    
    case "popup_yazdir": Width = 720;Height = 490;break;    
    case "popup_adres": Width = 700;Height = 500;break;    
    case "popup_cart": Width = 750;Height = 500;break;
    
}


var popW = Width, popH = Height;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;
if (popH > 500)
	topPos =0;
	
     openModalDialog(theURL, "", popW, popH);
}

//ortalanmış pencere açımı
var w = 800, h = 600;
function popupImg(urnKod, imgKodDef,type)
{      
	Width = 570;Height = 580;
	var popW = Width, popH = Height;
	
	var theURL = "/Moduls/resimGoster/basic/showImage.aspx?urn=" + urnKod + "&def=" + imgKodDef;
    if (type=='zoom')
    {
	    theURL = "/Moduls/resimGoster/zoom/zoomImage.aspx?urn=" + urnKod + "&def=" + imgKodDef + "&lang=" + lang;
	    if (typeof(parent.popZoomW) != 'undefined')
	    {     popW = parent.popZoomW + 140; popH = parent.popZoomH + 60;}
    }
    else if (type=='flash')
    {
	    theURL = "/Moduls/resimGoster/flash/showFlash.aspx?urn=" + urnKod + "&def=" + imgKodDef + "&wt=" + parent.popZoomFW  + "&ht=" + parent.popZoomFH;
	    if (typeof(parent.popZoomFW) != 'undefined')
	    {   popW = parent.popZoomFW + 90; popH = parent.popZoomFH + 10;}
    }
    else
    { 
       if (typeof(parent.popZoomW) != 'undefined')
       {     popW = parent.popZoomW + 90;  popH = parent.popZoomH + 30; }
    }
    // ekran boyutunu geçer ise kontrolü
    if (popH > screen.availHeight - 163)
	    popH = screen.availHeight - 163;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	// eğer ürünün resmi resim yok değilse çalışsın
	if (document.getElementById('imageBox').src.indexOf("resimyok") == -1)
	    openModalDialog(theURL, "", popW, popH);
} 

function openModalDialog(theURL, title, popW, popH)
{
    win = dhtmlmodal.open("popupbox", "iframe", theURL, title, ",width=" + popW + ",height="+ popH + ",center=1,resize=0,scrolling=0,allowDrag=0", "recal")
}

function openPopupClasic(theURL,winName,popupLocation)
{
	Width = 400;Height = 400;

    switch (popupLocation)
    {
        case "popup_chat": Width = 600;Height = 500;break;
    }


    var popW = Width, popH = Height;

    var leftPos = (w-popW)/2, topPos = (h-popH)/2;
    if (popH > 500)
	    topPos =0;
    	
    winName1 = window.open(theURL,winName,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',status=0,resizable=1,scrollbars=yes');
    winName1.focus();
}
