// JavaScript Document

var opm;
var t;

function showTab(baseName,openTab,tabCount) {
	if (openTab==0) {
		var tpAppend="-F";
	}
	else if (openTab==(tabCount-1)) {
		var tpAppend="-L";
	}
	else {
		var tpAppend="-F";
	}
	
	for (i=0;i<tabCount;i++) {
		if (i==0) {
			var acAppend="-F";
		}
		else if (i==(tabCount-1)) {
			var acAppend="-L";
		}
		else {
			var acAppend="";
		}

		if (openTab==i) {
			document.getElementById(baseName+'-tab-'+i).style.display='';
			document.getElementById(baseName+'-tab-a-'+i).className='ac ac'+acAppend;
			document.getElementById(baseName+'-tab-s').className='tp-s'+tpAppend;
		}
		else {
			document.getElementById(baseName+'-tab-'+i).style.display='none';
			document.getElementById(baseName+'-tab-a-'+i).className='ps ps'+acAppend;
		}
	}
	document.body.focus();
}

function mExp() {
	document.getElementById('fmenu').style.overflow='visible';
	
}
function mCol() {
	document.getElementById('fmenu').style.overflow='hidden';

}


function radyo(a) {
	window.open('http://radyo.gnctrkcll.turkcell.com.tr/','gnctrkcllradyo', "width=513,height=496");
}

function $S(id) {
	return $(id).style;
}

function sm(mid) {
	clearTimeout(t);
	for(i=0;i<opc+1;i++) {
		$S('sbm-'+i).display='none';
	}
	$S('sbm-'+mid).display='';
	$('msm').className="sub-"+mid;
	
}

function sx() {
	clearTimeout(t);
	t=setTimeout("sxm()",1200)
}

function sh() {
	clearTimeout(t);
}

function sxm() {
	sm(opm);	
}


function getList(divid,src) {
	
	var http = false;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
	  http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  http = new XMLHttpRequest();
	} 

	http.open("GET", src, true);
	http.onreadystatechange=function() {
	if(http.readyState == 4) {
		document.getElementById(divid).innerHTML= http.responseText;
	}
	}
	http.send(null);
}




var iller = new Array("colins","hotic","lescon","polo","sevenhill","sochic","stevemadden");
var marka;

function showHideGiyim()
{
	marka = document.getElementById("shops").value;
	hideCitys();
	document.getElementById('giyimadres').innerHTML= "";
	document.getElementById(marka).style.display = "";
        
}
function hideCitys()
{
	for (i=0;i<iller.length;i++)
	{
		document.getElementById(iller[i]).style.display = "none";
	}
}
function showAddress()
{
	var city;
	var url;
	city = document.getElementById(marka).value;
	url = marka + "-" + city ;
	if (marka!="" & city!="")
	{
		getList('giyimadres','/json/giyim/l/'+url);
	}
}


function showAddressSinema()
{
	var city;
	city = document.getElementById("sinemail").value;
	if (city!="")
	{
		getList('sinemaadres','/json/sinemakampanya/l/'+city+'-sinema');
	}
}

function bookmark(ths) {
	var user_agent = navigator.userAgent;
	var isOpera = user_agent.indexOf("Opera") >= 0;
	var isFirefox = user_agent.indexOf("Firefox") >= 0;
	var isWin32up = user_agent.indexOf("Win32") >= 0
		|| user_agent.indexOf("Win64") >= 0
		|| user_agent.indexOf("Windows NT") >= 0;

	var isIE = !isOpera && user_agent.indexOf("MSIE") >= 0;
	
	var title = document.title;
	var url = location.href;
	if (isIE && window.external != null) {
		window.external.AddFavorite(url,title);
	} else if (isFirefox) {
		window.sidebar.addPanel(title,url,"");
	} else if (isOpera) {
		ths.rel = "sidebar";
		ths.title = title
		ths.href = url;
	}
}


function loginPopup() {
	//window.location.href = 'https://login.gnctrkcll.turkcell.com.tr/';
	try {	
		hideObjects();
		//  
		// 
		Dialog.info('<div class="ploginlogo"></div><div class="plogin"><iframe src="/index/login" frameborder="0" width="620" height="380" scrolling="no"></iframe></div><div class="ploginclose"><a href="javascript:void(0);" onclick="pLoginClose();"></a></div>',{className: "alphacube",zIndex:10, width:770,height:410,showEffectOptions:{duration:0}});
	}
	catch (err) {
		// postpone
		
	}	
	return false;
	
}

function pLoginClose() {
	Dialog.closeInfo();
	showObjects();
	
}

function showObjects() {
	$$("object").findAll(function(node){
	      return node;
	    }).each(function(node){
	          node.show();
	    });	
}


function hideObjects() {
	$$("object").findAll(function(node){
	      return node;
	    }).each(function(node){
	          node.hide();
	    });	
}


