function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
} 
function regKontrolgiris(pattern, value) 
{ 
   r = new RegExp(pattern, "g"); 
   return r.test(value); 
} 
 
function formKontrolgiris(form) 
{ 
     patternEposta   = "^"+"([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0-9_\.\-]+)"+"@"+"([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0-9_\.\-]+)"+"[\.]"+"([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0-9_\.\-]+)"+"$"; 
           
     if ( !regKontrolgiris(patternEposta,form.kullaniciadi.value)) 
     { 
          alert("Lütfen Doğru Bir E-posta Adresi Giriniz."); 
         // form.kullaniciadi.value=""; 
          form.kullaniciadi.focus(); 
          return false; 
     } 
	 
	    if ( form.sifre.value=="" ) 
     { 
          alert("Lütfen Şifrenizi Giriniz."); 
          form.sifre.value=""; 
          form.sifre.focus(); 
          return false; 
     } 
     return true; 
} 

function c24_showLanguage(showString)
{
	if (showString.indexOf(".gif") != -1)
		{
		showString='<img src="/'+ showString +'" width="100" height="12" border="0" style="margin:1px 0 1px 0;" alt="" />';
		}

	document.getElementById("showlang").innerHTML = (showString != "") ? showString : "Choose your language:";
}


function c24_showToolboxText(textToShow, showOffState)
{
	showOffState = showOffState | 0;
	var el = document.getElementById("toolbox-text");
	el.style.color = (showOffState == 1) ? "#B9B9B9" : "#666666";
	el.innerHTML = textToShow;
}


function getStyle(el, stylePropJs, stylePropCss)
{
	var obj = document.getElementById(el);
	if (obj.currentStyle) // IE
		var styleValue = obj.currentStyle[stylePropJs];
	else if (window.getComputedStyle) // Mozilla
		var styleValue = document.defaultView.getComputedStyle(obj,null).getPropertyValue(stylePropCss);
	return styleValue;
}


function hideDiv(idDiv) 
{
	document.getElementById(idDiv).style.display = 'none';
}

// ===============================================================================================================================

function showDiv(idDiv) 
{
	document.getElementById(idDiv).style.display = '';
}

	
function showTab(tabname, tabno, maxtabs)
{
	if (document.getElementById)
	{		
		for (var i = 1; i <= maxtabs; i++)
		{
			if (document.getElementById(tabname + i)) document.getElementById(tabname + i).style.display = (tabno == i) ? "block" : "none";
			if (document.getElementById(tabname + i + '_link')) document.getElementById(tabname + i + '_link').className = (tabno == i) ? "atablink" : "tablink";
		}
	}
}

// ===============================================================================================================================

function showHideLanguageDiv(show)
{
	if (document.getElementById)
	{
		c = document.getElementById("current-language");
		h = document.getElementById("current-language-helper");
		l = document.getElementById("current-language-link");
		s = document.getElementById("select-language");
		
		if (show)
		{
			c.style.color = "#003466";
			c.getElementsByTagName("div")[1].style.color = "#01314A";
			c.style.background = "#FE6601 url(images/layout/bg-nav-main-li-current.gif) no-repeat top left";
			h.style.background = "transparent url(images/layout/bg-nav-main-li-current-span.gif) no-repeat top right";
			l.style.color = "#003466";
			s.style.display = "block";
		}
		else
		{
			c.style.color = "#000000";
			c.getElementsByTagName("div")[1].style.color = "#000000";
			c.style.background = "transparent url(images/layout/arrow-down-orange.gif) no-repeat right 6px";
			h.style.background = "none";
			l.style.color = "#000000";
			s.style.display = "none";
		}
	}
}

// ===============================================================================================================================

function showHideDealerLanguageDiv(show)
{
	if (document.getElementById)
	{
		s = document.getElementById("select-language-dealer");
		s.style.display = (show) ? "block" : "none";
	}
}

// ===============================================================================================================================

function check_email(email) 
{

 	var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  	var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,6}";
  	var regex  = "^" + usr + "\@" + domain + "$";
  	var rgx    = new RegExp(regex);
  	return rgx.exec(email) ? true : false;
}

// ===============================================================================================================================

function format_fieldcolor(idDiv, showError)
{
	showError = showError | false;
	var errorClass = "fc-error";
	var normalClass = "fc-normal";
	var labelColor = (showError) ? "#CC0000" : "";
	var d = document.getElementById(idDiv);
	var currentClass = d.className;
	var myLabel = "labelfor_" + idDiv;
	
	if (showError)
	{
		var showClass = errorClass;
		var oppClass = normalClass;
	}
	else
	{
		var showClass = normalClass;
		var oppClass = errorClass;
	}
	
	if (currentClass == "" || currentClass == oppClass)
	{
		d.className = showClass;
	}
	else
	{
		var indexOfSpace = currentClass.indexOf(" ");
		if(indexOfSpace == -1)
		{
			d.className = currentClass + " " + showClass;
		}
		else
		{
			var mainClass = currentClass.substring(0, indexOfSpace + 1);
			d.className = mainClass + " " + showClass;
		}
	}
	
	if (document.getElementById(myLabel)) document.getElementById(myLabel).style.color = labelColor;
}

// ===============================================================================================================================

function fieldcolor_normal(idDiv)
{
	format_fieldcolor(idDiv);
}

// ===============================================================================================================================

function fieldcolor_error(idDiv)
{
	format_fieldcolor(idDiv, true);
}
