﻿function checkTextAreaLen2(element, MaxLen) {
		elementTA = document.forms(0).elements[element];
		//elementCL = document.getElementById(element+ "CHARLEFT");//forms(0).elements[element + "CHARLEFT"];
	   var StrLen = elementTA.value.length, CharsLeft = 0;
		if (StrLen == 1 && elementTA.value.substring(0, 1) == " ") {
			elementTA.value = "";
			StrLen = 0;
		}
		if (StrLen > MaxLen ) {
			elementTA.value = elementTA.value.substring(0, MaxLen);
		}
		else {
			CharsLeft = StrLen;	
		}
		//elementCL.innerText = MaxLen - CharsLeft;
	}

function GetB2BSITE()
{
	eval(window.open('http://b2b.vestel.com.tr/dev/b2b','b2b','width=1010,height=730,toolbar=0,menubar=0,location=0,status=0,scrollbars=1,resizable=1,left=0,top=0'));
	//MyWin = eval(window.open("/dev/b2b/","b2b","toolbar=0,location=0,directories=0,status=0,statusbar=0,menubar=0,scrollbars=1,resizeable=1,width=1010,height=730,top=0,left=0"));
	
}
		
function PopupWinScroll(adres, Boyut_X, Boyut_Y)
{
	
	MyWin = eval(window.open(adres,"new","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=" + Boyut_X + ",height=" + Boyut_Y + ",top=50,left=50"));
}
//function PopupWinScroll(adres,wname, Boyut_X, Boyut_Y)
//{	
//	MyWin = eval(window.open(adres,wname,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=" + Boyut_X + ",height=" + Boyut_Y + ",top=50,left=50"));
//	MyWin.focus();
//}
function PopupWin(adres, Boyut_X, Boyut_Y)
{
	EWin = eval(window.open(adres,"quoted","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=" + Boyut_X + ",height=" + Boyut_Y + ",top=50,left=50"));
}

function PopupMedia(mediaUrl, boyut_x, boyut_y)
{
	nwWin = eval(window.open("/msib20/templates/reklam.asp?vSrc="+mediaUrl,"quoted","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=1,width=" + boyut_x + ",height=" + boyut_y + ",top=50,left=50"));
}
function PopupOpnNewWindow(adres,Boyut_X,Boyut_Y)
{
	//window.open(adres,'VsDergi',width=" + Boyut_X + ",height=" + Boyut_Y + ");
	MyWin = eval(window.open(adres,"new1","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,,width=" + Boyut_X + ",height=" + Boyut_Y + ",top=50,left=50"));
}

function PopupnewMedia(mediaUrl, boyut_x, boyut_y)

{
	
	var newWindow;
	var oldVbrowser = parseInt(navigator.appversion) < 3;

	
	newWindow= window.open("","sub","status,height="+boyut_y+",width="+boyut_x);

	if (!newWindow.opener)
	{
	newWindow.opener=window;
	}
	setTimeout("waitMe()",500);
	
	var myContent="<HTML><HEAD><TITLE>VESTEL VIDEOS</TITLE></HEAD>";
	myContent+="<BODY><EMBED SRC='http://bizerhant"+mediaUrl+"'></EMBED></BODY></HTML>" 
	newWindow.document.write(myContent);
	newWindow.document.close(); 
	
	if (!oldVbrowser )
	{
		newWindow.focus();
	}
}

/// Input alanina harf girilmesini engeller textbox'a alttaki event eklenmesi yeterli
/// onkeypress="self.event.returnValue=onlyNumeric(event);"
function onlyNumeric(element) {	
	//alert(window.event.srcElement.value);
	var whichCode = (window.Event) ? element.which : element.keyCode;
	
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 44) return true;  // Enter
	//BERKAYC: NOKTA DA GIRILEBILSIN, DECIMAL SAYILAR ICIN

	if (whichCode > 57 ){
	return false;}
	if (whichCode < 48 && whichCode > 13){
	return false;}
}

function popup_pKampanya(url,ww,wh,nm){
FWin = window.open(url, nm,"toolbar=0,top=20,left=20,width=" + ww + ",height=" + wh + ",location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1");
FWin.focus();
}


function showDiv(divID)
{
	if (document.getElementById(divID).style.display == 'none')
		document.getElementById(divID).style.display = 'block';
	else 
		document.getElementById(divID).style.display = 'none';
}
// Form required field check : Ad ve aciklama listelerinde ayni tipler için siralama ayni olmali 
// 
// parameters:  textbox namelist : check edilecek checkbox adlari
//				textbox description :Hata mesajinda yer alacak checkbox Adi  
//				combo  namelist : check edilecek combo adlari
//				combo description :Hata mesajinda yer alacak combolist Adi  
//				radio namelist : check edilecek radio btn adlari
//				radio description :Hata mesajinda yer alacak radio btn Adi  
//				
function FormCheck(txtlst,txtdsc,combolst,combodsc,radiolst,radiodsc)
{
	
radiolst=""	; // Radio buton check kontrolu sorunlu düzeltilmesi gerek ErhanT
	if (txtlst.length>0)
	{
		var txtfields= txtlst.split(",");
		var txtdesc= txtdsc.split(",");
		
		for (var i=0;i<txtfields.length;i++)
		{	
			if (document.getElementById(txtfields[i]).value.length == 0)
			{
				alert("Lütfen *" + txtdesc[i]+ "* zorunlu alanini doldurun.");
				document.getElementById(txtfields[i]).focus();
				return false;
			} 
		}		
	}
	
	if (combolst.length>0)
	{
		var combofields=combolst.split(",");
		var combodesc=combodsc.split(",");
		
		for (i=0;i<txtfields.length;i++)
		{	
			if(document.getElementById(combofields[i]).selectedIndex == -1)
			{
				alert("Lütfen *" + combodesc[i]+ "* zorunlu alanini doldurun.");
				document.getElementById(combofields[i]).focus();
				return false;
			} 
		}		
	}
		if (radiolst.length>0)
	{
		var rdfields=radiolst.split(",");
		var rddesc=radiodsc.split(",");
		
		var allfields = document.getElementsByTagName("INPUT")
		var rdchecked, rdexist;
		
		
		for (var j = 0 ; j< rdfields.length; j++)
		{	
			rdexist=false;
			rdchecked= false;
			for (i=0;i<allfields.length;i++)
			{
				//alert(rdfields[j]+"//"+allfields[i].getAttribute("name",0)+" -- "+ allfields[i].checked);
				if(allfields[i].getAttribute("name",0) == rdfields[j] )
					{
							rdexist=true;
							if (allfields[i].checked)
							rdchecked= true;
					}
				if (!rdchecked &&  rdexist )
				{
					alert("Lütfen *" + rddesc[i]+ "* zorunlu alanini doldurun.");
					allfields[i].focus();
					return false;		
				}
			}		
		}
	}
	return true;	 
			
}


function OpenLoadingDiv()
{
	
	if(window.name!="pKampanya" && window.name !="pUrunKampanya")
	{
			window.location.href= "/msib20/YetkisizGiris.htm";
	}
	else
	{
	document.getElementById('loadDiv').style.display = 'block';
	}
		
		
}

// Form required field check : Ad ve aciklama listelerinde ayni tipler için siralama ayni olmali 
// 
// parameters:  textbox namelist : check edilecek checkbox adlari
//				textbox description :Hata mesajinda yer alacak checkbox Adi  
//				combo  namelist : check edilecek combo adlari
//				combo description :Hata mesajinda yer alacak combolist Adi  
//				radio namelist : check edilecek radio btn adlari
//				radio description :Hata mesajinda yer alacak radio btn Adi  
//	
function FormCheckEN(txtlst,txtdsc,combolst,combodsc,radiolst,radiodsc)
{
	
radiolst=""	; // Radio buton check kontrolu sorunlu düzeltilmesi gerek ErhanT
	if (txtlst.length>0)
	{
		var txtfields= txtlst.split(",");
		var txtdesc= txtdsc.split(",");
		for (var i=0;i<txtfields.length;i++)
		{	
			if (document.getElementById(txtfields[i]).value.length == 0)
			{
				alert("Please fill * " + txtdesc[i]+ " * required field.");
				document.getElementById(txtfields[i]).focus();
				return false;
			} 
		}		
	}
	
	if (combolst.length>0)
	{
		var combofields=combolst.split(",");
		var combodesc=combodsc.split(",");
		
		for (i=0;i<txtfields.length;i++)
		{	
			if(document.getElementById(combofields[i]).selectedIndex == -1)
			{
				alert("Please fill " + combodesc[i]+ " required field.");
				document.getElementById(combofields[i]).focus();
				return false;
			} 
		}		
	}
		if (radiolst.length>0)
	{
		var rdfields=radiolst.split(",");
		var rddesc=radiodsc.split(",");
		var allfields = document.getElementsByTagName("INPUT")
		var rdchecked, rdexist;
		
		for (var j = 0 ; j< rdfields.length; j++)
		{	
			rdexist=false;
			rdchecked= false;
			for (i=0;i<allfields.length;i++)
			{
				if(allfields[i].getAttribute("name",0) == rdfields[j] )
					{
							rdexist=true;
							if (allfields[i].checked == true)
							rdchecked= true;
					}
				if (!rdchecked && rdexist )
				{
					alert("Please fill " + rddesc[i]+ " required field.");
					allfields[i].focus();
					return false;		
				}
			}		
		}
	}
	return true;	 
			
}

function checkTextAreaLen(element, MaxLen) {
		elementTA = document.forms(0).elements[element];
		elementCL = document.getElementById(element + "CHARLEFT");//forms(0).elements[element + "CHARLEFT"];
	   var StrLen = elementTA.value.length, CharsLeft = 0;
		if (StrLen == 1 && elementTA.value.substring(0, 1) == " ") {
			elementTA.value = "";
			StrLen = 0;
		}
		if (StrLen > MaxLen ) {
			elementTA.value = elementTA.value.substring(0, MaxLen);
		}
		else {
			CharsLeft = StrLen;	
		}
		elementCL.innerText = MaxLen - CharsLeft;
	}
	

//by erhant for "yükleniyor"
function OpenDiv(divName)
{
		//B2B Menüsünde popupalara tıklandığında çalışıp hataya yol açıyordu kapatıldı
		//02 Ekim 2007 I.C. 
		//divName.style.display="block";
		
}


function CloseDiv(divName)
{
		divName.style.display="none";
}
function setOpenDiv()
{
		
		var ml = document.getElementsByTagName("A");
		var count = ml.length;
		var i=0;
		for (i=0;i<count;i++)
		{
			ml[i].setAttribute("onClick","OpenDiv(divLOADING)");
		}
	}
		
function Browser() {
	var b=navigator.appName;
	if (b=="Netscape") this.b="ns";
	else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
	else if (b=="Microsoft Internet Explorer") this.b="ie";
	if (!b) alert('Unidentified browser./nThis browser is not supported,');
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns" && this.v>=4);
	this.ns4=(this.b=="ns" && this.v==4);
	this.ns6=(this.b=="ns" && this.v==5);
	this.ie=(this.b=="ie" && this.v>=4);
	this.ie4=(this.version.indexOf('MSIE 4')>0);
	this.ie5=(this.version.indexOf('MSIE 5')>0);
	this.ie55=(this.version.indexOf('MSIE 5.5')>0);
	this.ie6=(this.version.indexOf('MSIE 6')>0);
	this.opera=(this.b=="opera");
	this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
	this.def=(this.ie||this.dom); // most used browsers, for faster if loops
	var ua=navigator.userAgent.toLowerCase();
	if (ua.indexOf("win")>-1) this.platform="win32";
	else if (ua.indexOf("mac")>-1) this.platform="mac";
	else this.platform="other";
}
is = new Browser();

function mover(I) {
	document.getElementById('l'+I).src='../images/tmenu/l'+I+'_a.gif';
}

function mout(I) {
	document.getElementById('l'+I).src='../images/tmenu/l'+I+'_p.gif';
}
function moverEn(I) {
	document.getElementById('l'+I).src='../images_en/tmenu/l'+I+'_a.gif';
}

function moutEn(I) {
	document.getElementById('l'+I).src='../images_en/tmenu/l'+I+'_p.gif';
}

function preload() {
	for (i=1;i<=5;i++) {
		x=new Image();
		x.src='../images/tmenu/l'+i+'_p.gif';
	}
}

preload();
	
	
	//dom utilities
	
	function slideLayer(lyr,t,pr) {
		
		if (is.ie) {
			
			document.getElementById[lyr].style.top=t;
		} else if (is.ns6) {
			document.getElementById(lyr).style.top=t+'px';
		} else if (is.ns4) {
			document.layers[pr].document.layers[lyr].top=t;
		}
	}
	
	function writeLayer(lyr,pr,cont) {
		if (is.ie) {
			document.getElementById[lyr].innerHTML=cont;
		} else if (is.ns6) {
			document.getElementById(lyr).innerHTML=cont;
		} else if (is.ns4) {
			
			document.layers[pr].document.layers[lyr].document.open();
			document.layers[pr].document.layers[lyr].document.write(cont);
			document.layers[pr].document.layers[lyr].document.close();
		}
	}

function selectGo(u) {
	if (u!='' && u!='#') {
		location.href=u;
	}
}

function swapA(I) {
		var txt=new Array();
		txt[0]='';
		txt[1]='Elektronik Ürünler';
		txt[2]='Bilisim Ürünleri';
		txt[3]='Beyaz Esya';
		txt[4]='Klimalar';
		txt[5]='Uydu Sistemleri';
		txt[6]='Küçük Ev Aletleri';
		txt[7]='Ankastreler';
		txt[8]='Otel Ürünleri';
		
		
		document.getElementById('icon'+I).src='../images/icon/'+I+'o.gif';
		
		document.getElementById('iconText').className='urunP';
		document.getElementById('iconText').innerHTML=txt[I];
		
	}
	
function swapP(I) {
		
		document.getElementById('iconText').innerHTML='';
		document.getElementById('iconText').className='urunP';
		document.getElementById('icon'+I).src='../images/icon/'+I+'.gif';
}
	
 function popup(url,ww,wh,nm)
     {
        FWin = window.open(url,nm,"toolbar=0,top=20,left=20,width=" + ww + ",height=" + wh + ",location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0");
        //FWin.title = nm;
        FWin.focus();
      }
	
	 function showpopup(url,ww,wh,nm)
     {
        FWin = window.open(url,"pKampanya","toolbar=0,top=20,left=20,width=" + ww + ",height=" + wh + ",location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=1");
        //FWin.title = nm;
        FWin.focus();
      }
	
function openPrint(url) {
		
		ww=600;
		wh=500;
        pvWin = window.open(url,"Talihli","toolbar=0,top=20,left=20,width=" + ww + ",height=" + wh + ",location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0");
        //FWin.title = nm;
        pvWin.focus();
      
}



