
//Numeric kontrol
function IsNumeric(strString){
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   for (i = 0; i < strString.length && blnResult == true; i++){
	  strChar = strString.charAt(i);
	  if (strValidChars.indexOf(strChar) == -1)
		 {
		 blnResult = false;
		 
		 }
	  }
   return blnResult;
   }
   
  //webMesaj ekranı 
function Messages(f) {
	var f				= document.frm01;
	var intPhone		= f.frmPhone;
	var strMessage		= f.frmMessage
	//alert(strPass.value)
		if ((intPhone.value == '') || (!IsNumeric(intPhone.value)) || (intPhone.value.length != 10) ) {
			alert('Telefon no. bilgisi on haneli olarak, 5321111111 gibi, girilmelidir. ');intPhone.focus();return false;
		}
		if ((strMessage.value=='') || (strMessage.value.length>320)){
		alert ('Mesaj alanı bos bırakılamaz ve 320 karekterden büyük olamaz');strMessage.focus();return false;
		}
	}
	
	//Login 
	function loginCheck(f) {
	var f				= document.frm02;
	var intPhone		= f.frmPhone;
	var strPass			= f.frmPass
		if ((intPhone.value == '') || (!IsNumeric(intPhone.value)) || (intPhone.value.length != 10) ) {
			alert('Telefon no. bilgisi on haneli olarak, 5321111111 gibi, girilmelidir. ');intPhone.focus();return false;
		}
		if ((strPass.value=='') || (strPass.value.length>320)){
		alert ('Şifre alanı bos bırakılamaz ve 10 karekterden büyük olamaz');strPass.focus();return false;
		}
	}
			
/*turkish charecter replace and maxlength counter coder iso */
function charCheck(obj){
var inChar=new Array ("ğ","Ğ","ü","Ü","ş","Ş","İ","ı","ö","Ö","ç","Ç");
var outChar=new Array("g","G","u","U","s","S","I","i","o","O","c","C");
var messageTxt=obj.value;
var messageLength=messageTxt.length;
for (j=0;j<messageLength;j++) {
   for (i=0;i<inChar.length;i++) {
   messageTxt=messageTxt.replace(inChar[i],outChar[i]);
   }
}
obj.value=messageTxt;
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}


/* header url kontrol*/

function kontoral() {

 doRequest("kontorsatinal");

window.open('https://csi.turkcell.com.tr/services/rechargeCounter3D','csi','top=0,left=0,status=yes,scrollbars=no,resizable=no,width=850,height=600');

}


function webMesajGonder(){
	doRequest("mesajGonder");
	window.open('https://visas.turkcell.com.tr/amserver/UI/Login?locale=tr&goto=https://csi.turkcell.com.tr/csi/rechargeCounter3D?csiEntranceId=0101&banner=oim_20080218_ucretsizMesajGonder','csi','top=0,left=0,status=yes,scrollbars=no,resizable=no,width=850,height=600');
}	

		function doRequest(paremeter){
			var request = false;
			var url = "/"+paremeter;
			 try {
			   request = new XMLHttpRequest();
			 } catch (trymicrosoft) {
			   try {
				 request = new ActiveXObject("Msxml2.XMLHTTP");
			   } catch (othermicrosoft) {
				 try {
				   request = new ActiveXObject("Microsoft.XMLHTTP");
				 } catch (failed) {
				   request = false;
				 }
			   }
			 }
		
			 if (request) {
				request.open("GET",url,true)
				request.send(null)
			 }
		}



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;

// disallow Opera faking IE
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 bookmark(){
	var title=$("title").html();
    var url = location.href;
	
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if( window.opera && window.print )
    {
    var mbm = document.createElement('a');
    ambmsetAttribute('rel','sidebar');
    mbm.setAttribute('href',url);
    mbm.setAttribute('title',title);
    mbm.click();
    }
    else if( document.all ) window.external.AddFavorite( url, title);
}*/

function shareThisPage(destSite){
	
	var title = "";	
	try{
		title = $("title").html();
	}catch(err){
		title = "Turkcell";
	}		
	/*
	var description = "";
	try{
		description = $(".subContentPromoContent h3").html() + " \n";
	}catch(err){	
	}	
	
	try{
		description += $(".subContentPromoContent p").html() + " ";
	}catch(err){	
	}
	*/
	thisUrl = location.href;
	var targetURL = "";
	var reportURL = "http://www.turkcell.com.tr/webtrends.jpg?uyg=20080401_KampanyaPaylas_"
	var ranNum= Math.floor(Math.random()*123456788901524475689);
	
	switch (destSite){
		case "Del.icio.us":
			targetURL = "http://del.icio.us/post?url=" + thisUrl + "&title="+ title;
			reportURL += "Delicious"
		break;
		case "Digg":
			targetURL = "http://digg.com/submit?url=" + thisUrl + "&title=" + title;
			reportURL += "Digg"
		break;
		case "Myspace":
			targetURL = "http://www.myspace.com/Modules/PostTo/Pages/?c="+ thisUrl + "&t=" + title;
			reportURL += "Myspace"
		break;
		case "Facebook":
			targetURL = "http://www.facebook.com/sharer.php?u=" + thisUrl;
			reportURL += "Facebook"
		break;
		case "Google Bookmarks":
			targetURL = "http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=" + thisUrl  + "&title=" + title;
			reportURL += "GoogleBookmarks"
		break;
		case "Yahoo Myweb":
			targetURL = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + thisUrl + "&t=" + title;
			reportURL += "YahooMyweb"
		break;
		case "StumbleUpon":
			targetURL = "http://www.stumbleupon.com/refer.php?url=" + thisUrl + "&title=" + title;
			reportURL += "StumbleUpon"
		break;
		case "Reddit":
			targetURL = "http://reddit.com/submit?url=" + thisUrl + "&title=" + title;
			reportURL += "Reddit"
		break;
		case "Newsvine":
			 targetURL = "http://www.newsvine.com/_tools/seed&save?u=" + thisUrl + "&h=" + title;
			 reportURL += "Newsvine"
		break;
		case "Live Bookmarks":
			targetURL = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=" + thisUrl + "&title="+ title;
			reportURL += "LiveBookmarks"
		break;
		
		case "Technorati":
			targetURL = "http://www.technorati.com/faves?add=" + thisUrl;
			reportURL += "Technorati"
		break;
		case "Twitter":
			targetURL = "http://twitter.com";
			reportURL += "Twitter"
		break;
		case "Yahoo Bookmarks":
			targetURL = "http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=" + thisUrl + "&title="+ title;
			reportURL += "YahooBookmarks"
		break;
		case "myAOL":
			targetURL = "http://favorites.my.aol.com/ffclient/webroot/0.4.1/src/html/addBookmarkDialog.html?url="+ thisUrl + "&title="+ title;
			reportURL += "myAOL"
		break;
	}
	if(targetURL != ""){
		reportURL += "&random=" +  ranNum;
		//alert(reportURL);
		try{
			document.getElementById('starRating').src = reportURL
		}catch(e){
			frames['starRating'].location.href = reportURL
		}
		window.open(targetURL,"_blank");
	}	
}


/**Navigasyon kontrolu*/
		//alert(typeof($("#nav"))!='object');
		//alert(typeof(window.document.getElementById('nav'));
		
			
		var activeNav = -1;
		var activeClassName = '';
		var activeLinkTimer = null;
	
		$(document).ready(function(){
			if (document.getElementById('nav')!=null && document.getElementById('nav')!='undefined'){
				var el = document.getElementById('nav');
				//alert(el)
				for( var i = 0; i < el.childNodes.length; i++ ) {
					if (el.childNodes[i].tagName == 'li' || el.childNodes[i].tagName == 'LI') {
					//
						el.childNodes[i].onmouseover = null;

						el.childNodes[i].onmouseover = function () {
							var el = document.getElementById('nav');
							for( var j = 0; j < el.childNodes.length; j++ ) {
								
								if ((el.childNodes[j].className == 'on') || el.childNodes[j].className == 'onGreen' ||  el.childNodes[j].className == 'onGold') {

										activeNav = j;
										activeClassName = el.childNodes[j].className;
										if(activeNav!=-1){
											el.childNodes[activeNav].className = '';
										}
										break;
								}
								
								
							}
							if(activeClassName == ''&& this.childNodes[2]!= 'undefined' && this.childNodes[2]!= null ){

								//this.childNodes[2].style.display='block';
								//$(this.childNodes[2]).show();
								var childeNodes2 = this.childNodes[2];
								setTimeout(function() {childeNodes2.style.display='block';},15);
								
							}
							else{
								//alert(this.childNodes.length)
								this.className = activeClassName;
								
							}
							clearTimeout(activeLinkTimer);
							
						}
						el.childNodes[i].onmouseout = null;
						el.childNodes[i].onmouseout = function() {
							this.className = '';
							if(activeNav==-1 && this.childNodes[2]!= 'undefined' && this.childNodes[2]!= null ){
								//alert(this.childNodes[2].style)
								//this.childNodes[2].style.display='none';
								var childeNodes2 = this.childNodes[2];
								setTimeout(function() {childeNodes2.style.display='none';},15);
								
								//this.childNodes[2].style.display='none';
								//$(this.childNodes[2]).hide("slow");
							}
							activeLinkTimer = setTimeout('setActiveLink();',200)
						}
	
					}
				}
			}
		});
		
		
		function setActiveLink() {
			var el = document.getElementById('nav');
			if(activeNav!=-1){
				el.childNodes[activeNav].className = activeClassName;
			}
		}




