﻿var imageButton;

function hideElement (elementId) {
var element;
if (document.all)
element = document.all[elementId];
else if (document.getElementById)
element = document.getElementById(elementId);
if (element && element.style)
element.style.display = 'none';
}

function showElement (elementId) {
var element;
if (document.all)
element = document.all[elementId];
else if (document.getElementById)
element = document.getElementById(elementId);
if (element && element.style)
element.style.display = '';
}

function ulketurkiye() {
showElement("turksehir");
showElement("ilcelerx");
}

function ulkeyabanci() {
showElement("digersehir");
hideElement("turksehir");
hideElement("ilcelerx");
}

function ulketurkiye2() {
showElement("turksehir2");
showElement("ilcelerx2");
}

function ulkeyabanci2() {
showElement("digersehir2");
hideElement("turksehir2");
hideElement("ilcelerx2");
}


function ulkesecildi_tabChange() {
var secili;
secili = document.getElementById('tc1_TabPanel1_adr_ulke').options[document.getElementById('tc1_TabPanel1_adr_ulke').selectedIndex].value;

if (secili == "115") {

showElement("turksehir");
showElement("ilcelerx");
hideElement("digersehir");
}
else
{
showElement("digersehir");
hideElement("turksehir");
hideElement("ilcelerx");
}


var secili2;
secili2 = document.getElementById('tc1_TabPanel2_adr2_ulke').options[document.getElementById('tc1_TabPanel2_adr2_ulke').selectedIndex].value;

if (secili2 == "115") {

showElement("turksehir2");
showElement("ilcelerx2");
hideElement("digersehir2");
}
else
{
showElement("digersehir2");
hideElement("turksehir2");
hideElement("ilcelerx2");
}
}




function ulkesecildi(as) {
var secili;
secili = document.getElementById('tc1_TabPanel1_adr_ulke').options[document.getElementById('tc1_TabPanel1_adr_ulke').selectedIndex].value;

if (as =="1") {
secili == "115";
}

if (secili == "115") {

showElement("turksehir");
hideElement("digersehir");
showElement("ilcelerx");
}
else
{
showElement("digersehir");
hideElement("turksehir");
hideElement("ilcelerx");
}
}

function sehirsecildi() {
showElement("ilcelerx");
}

function URLDecode(psEncodeString) 
{
  return unescape(psEncodeString); 
}

function URLEncode(psEncodeString) 
{
  return escape(psEncodeString); 
}



function resim_goster(kurl,burl,title)
{
//hideElement("urun_ana_resim2");
document.getElementById("urun_ana_resim").height = 250;
document.getElementById("urun_ana_resim").innerHTML = "<a id=urun_resim_link rel='lightbox' Title='"+title+"' href='"+burl+"'><img id='urun_resim' src='"+kurl+"' style='border-width:0px;' /></a>";
initLightbox();

}

function sol_sepeti_gizle()
{
hideElement("sol_sepet_468451");
}

function sol_sepeti_goster()
{
showElement("sol_sepet_468451");
}

function sepete_ekle_detay(urunno) {
ajaxpack.getAjaxRequest("ajax/sepeteekle.aspx", "urunno="+urunno, sepetback_detay, "txt");
}

function TaksitSec(btnn)
{
btnn.src = "/images/taksit_secili.jpg";
}

function sepete_ekle(urunno, btnn) {
    imageButton = btnn;
    btnn.src = "/images/bekleyin.jpg";
    ajaxpack.getAjaxRequest("ajax/sepeteekle.aspx", "urunno="+urunno, sepetback, "txt");
}

function aliste_ekle(urunno) {
ajaxpack.getAjaxRequest("ajax/alisteekle.aspx", "urunno="+urunno, alisteback, "txt");
}


function alisteback(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ 
	if (myajax.status==200 || window.location.href.indexOf("http")==-1)
		{ 
		alert("Ürün Alışveriş Listenize Eklendi");
		}
}
}

function sepetback(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ 
	if (myajax.status==200 || window.location.href.indexOf("http")==-1)
		{ 
        
    sol_sepeti_goster();
    SepetGuncelle();
    imageButton.src = "/images/eklendi.jpg";
		}
}
}

function MesajGoster(mesaj) {

var timeout;
function openInfoDialog() {
  Dialog.info(mesaj,{width:250, height:100, showProgress: true});
  timeout=4;
  setTimeout(infoTimeout, 1000)
}

function infoTimeout() {
  timeout--;
  if (timeout >0) {
    //Dialog.setInfoMessage("Test of info panel, it will close <br>in " + timeout + "s ...")
    setTimeout(infoTimeout, 1000)
 }
 else
  Dialog.closeInfo()
}
openInfoDialog();

}

function sepetback_detay(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ 
	if (myajax.status==200 || window.location.href.indexOf("http")==-1)
		{ 
		alert("Ürün Sepetinize Eklendi");
		}
}
}


var emailsonucu;

function emailkontrol(sender,args) {
ajaxpack.getAjaxRequest("ajax/ajx_email_kontrol.aspx", "email="+args.Value, emailback, "txt");
if (emailsonucu == "1") {
args.IsValid=false; 
return
}
else
{
args.IsValid=true;
return
}
}

function emailback(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ 
	if (myajax.status==200 || window.location.href.indexOf("http")==-1)
		{ 
			 if (myajax.responseText == "1") {
			 emailsonucu = "1";
				}
				 else 
				 {
                emailsonucu = "0";
				
				}
		}
}
}

function Tavsite_Et(urunno) {

Dialog.alert({url: "/ajax/tavsiyeet.aspx?ID="+urunno, options: {method: 'get'}}, {className: "alphacube", width:540, okLabel: "Kapat"});

}

function goUp() {

  if (window.scrollBy)
    window.scrollBy(0, window.innerHeight ? -window.innerHeight : - document.body.clientHeight);


}

function SepetTazele2()
{
   
}