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('WebMetre:/nUnidentified 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.opera=(this.b=="opera");
	this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
	this.def=(this.ie||this.dom);
	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();
//if (is.ns6) { var WinY = window.pageYOffset; var WinX = window.pageXOffset; WinW = window.innerWidth; WinH = window.innerHeight;}
//if (is.ie)  { var WinY = document.body.scrollTop; var WinX = document.body.scrollLeft; WinW = document.body.clientWidth; WinH = document.body.clientHeight;}
if (is.ie)  { var WinW = screen.availWidth; var WinH = screen.availHeight;}
function validate_email(input) {
	s= input.value
	if(s.search) {
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0)
	}
	if(s.indexOf) {
		at_character=s.indexOf('@')
		if(at_character<=0 || at_character+4>s.length)
			return false
	}
	if(s.length<6)
		return false
	else
		return true
}

function popUP(url, en, boy, param) {
	var params = "screenX=5,screenY=5,top=5,left=5,width="+en+",height="+boy+","+param;
	newWin = window.open(url, "Dummy", params)
	newWin.focus();
}

function phone_check(input) {
    var chars = "0123456789";
    var str = String(input)
    var len = str.length;
    
    if (len != 10) {           
       return false;		
    }
  
    if ( (str.charAt(3) == "0") || str.charAt(0) == "0" ) {
       return false;		
    }

    for (var i = 0; i < len; i++){  
        var chr = str.charAt(i);
        if (chars.indexOf(chr) == -1){
            return false;
        }
    }

    return true

}

function clearForm(f) {
	for (var i=0; i<f.elements.length; i++) {
		if (f.elements[i].type == 'text') {
			f.elements[i].value = '';
		} else if (f.elements[i].type.substring(0,6) == 'select') {
			f.elements[i].selectedIndex = 0;
		} else if (f.elements[i].type.substring(0,8) == 'checkbox') {
			f.elements[i].checked = false;
		} else if (f.elements[i].type.substring(0,5) == 'radio') {
			f.elements[i].checked = false;
		} else if (f.elements[i].type == 'textarea') {
			f.elements[i].value = '';
		}
	}
}

function checkAll(f) {
  for(var i=0 ; i<f.elements.length; i++) {
      var e = f.elements[i];
      if((e.type == 'checkbox') && (e.name != 'checkall'))
 	  e.checked = f.checkall.checked;
  }
}

function checkCtrl(f) {
  var len = f.elements.length;
  var totboxes = 0;
  var toton = 0;

	for(var i=0 ; i<len ; i++) {
		var e = f.elements[i];
		if((e.type == 'checkbox') && (e.name != 'checkall')) {
			totboxes++;
			if(e.checked) {
				toton++;
			}
		}
	}
	if(totboxes == toton) {
		f.checkall.checked = true;
	} else {
		f.checkall.checked = false;
	}
}

function setSelectOptions(the_form, the_select, do_check) {
    var selectObject = document.forms[the_form].elements[the_select];
    var selectCount  = selectObject.length;

    for (var i = 0; i < selectCount; i++) {
        selectObject.options[i].selected = do_check;
    } // end for

    return true;
} // end of the 'setSelectOptions()' function

function howMany(selectObject) {
var numberSelected = 0
	for (var i=0; i < selectObject.options.length; i++) {
		if (selectObject.options[i].selected==true)
			numberSelected++
	}
	return numberSelected
}
function IsDigit(allowDot) {
	if (allowDot)
		return ((event.keyCode >= 48) && (event.keyCode <= 57) || event.keyCode == 46)
	else
		return (event.keyCode >= 48) && (event.keyCode <= 57)
}

function getObj(name){if (document.getElementById){return document.getElementById(name);} else if (document.all){return document.all[name];} else if (document.layers) {return document.layers[name];} else return false;}
function getObjS(name){if (document.getElementById){return document.getElementById(name).style;} else if (document.all){return document.all[name].style;} else if (document.layers) {return document.layers[name];} else return false;}

function getIndex(what,which) {
	for (var i=0;i < what.elements.length;i++)
    	if (what.elements[i].name == which)
            return i;
    return -1;
}

function ZoomIn(tag, en, boy) {
var params = "location=no,directories=no,status=no,scrollbars=no,toolbar=no,resizable=no,dependent=yes,screenX=5,screenY=5,menubar=no,width="+en+",height="+boy;
	jszoom = window.open("", "Pencere", params);
	jszoom.document.open("text/html");
	jszoom.document.writeln("<html>");
	jszoom.document.writeln("<head>");
	jszoom.document.writeln("<title>Büyük Resim - Large Image</title>");
	jszoom.document.writeln("<head>");
	jszoom.document.writeln("<body bgcolor='#FFFFFF' leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>");
	jszoom.document.writeln("<table border=0 align=center cellspacing=0 cellpadding=0>");
	jszoom.document.writeln(" <tr>");
	jszoom.document.writeln("   <td align=center valign=top>"+tag+"</td></tr>");
	jszoom.document.writeln(" </tr><tr>");
	jszoom.document.writeln("   <td align=center valign=top>&nbsp;<br><a href='javascript:self.close()'><font face=Verdana,Geneva,Arial,Helvetica,sans-serif size=2>Pencereyi Kapat</font></a></td>");
	jszoom.document.writeln(" </tr>");
	jszoom.document.writeln("</table>");
	jszoom.document.writeln("</body></html>");
	jszoom.document.writeln("</html>");
	jszoom.focus();
}

function ZoomPic(url, en, boy) {
	ZoomIn("<img src='"+url+"' border=0>", en, boy);
}
function CurrencyFormatted(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function CommaFormatted(amount) {
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3) {
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + '.' + d; }
	amount = minus + amount;
	return amount;
}
function _print() {
    if (typeof(window.print) != 'undefined') {
        window.print();
  } else {
    alert('Sayfayı yazdırmak için, dosya->yazdır kullanınız.');
  }
}  
function __print() {
	if(typeof(Shell) == 'undefined')
		Shell = new ActiveXObject("WScript.Shell");
	if(typeof(Shell) != "undefined") { 
		KeyPath ="HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
		Shell.RegWrite(KeyPath + "footer", "");
		Shell.RegWrite(KeyPath + "header", "");
		window.focus();
		window.print();
	}
}
function _printSetup() { 
	document.body.insertAdjacentHTML('beforeEnd', '<OBJECT ID="WebBrowser1" style="display:none" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'); 
	var WebBrowser1 = document.getElementById("WebBrowser1");
	WebBrowser1.ExecWB(8, 1); 
	WebBrowser1.outerHTML = ""; 
} 

function CopyClipboard(v) {
	if (v) {
		window.clipboardData.setData('Text', v);
	}
}

// menu starts
menuId=1;
mouseoutLeft=0;
mouseoutRight=0;
mouseoutTop=0;
mouseoutBottom=0;

function showCats(id) {
        menuId = id;
        document.getElementById("menu"+id).style.display='block';
        hideLayers(1,"menu"+id,'','show');
}

function hideAll(){
        
        menuItems=document.getElementById("menu"+menuId);
        
        if((document.all) && (window.offscreenBuffering))
        {
                hide=false;
                if(window.event.clientX  < (mouseoutLeft+document.getElementById("MenuWrapper").offsetLeft+10)) hide=true;
                if(window.event.clientX  > mouseoutRight) hide=true;
                if(window.event.clientY < mouseoutTop) hide=true;
                if(window.event.clientY > mouseoutBottom) hide=true;
        
                if(hide)
                {
                        document.getElementById('killSelect').style.visibility='hidden';
                        document.getElementById('Layer').style.visibility='hidden';
                        menuItems.style.display='none';
                }
                
        }
        else
        {
                document.getElementById('killSelect').style.visibility='hidden';
                document.getElementById('Layer').style.visibility='hidden';
                menuItems.style.display='none';
        }
}

function findObj(n, d) {
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function hideLayers() {
        var i,p,v,obj,args=hideLayers.arguments;
        blubb=0;
        if(args[0]==1)blubb=1;
        for (i=blubb; i<(args.length-2); i+=3) 
                if ((obj=findObj(args[i]))!=null) 
                {
                        v=args[i+2];
                        blah=obj;
                        if (obj.style) 
                        {
                                obj=obj.style; 
                                v=(v=='show')?'visible':(v=='hide')?'hidden':v;
                                if(typeof document.all=='object'&&args[0]==1)zeigVersteckIframe(blah,v);
                        }       
                        obj.visibility=v;
                }
        }

function findeL(obj){
        var lPos = 0;
        if (obj.offsetParent){
                while (obj.offsetParent){
                        lPos += obj.offsetLeft;
                        obj = obj.offsetParent;
                }
                lPos=lPos-document.getElementById("MenuWrapper").offsetLeft;
        }
        else if (obj.x)
                lPos += obj.x;

        return lPos;
}

function findeO(obj){
        var oPos = 0;
        if (obj.offsetParent){
                while (obj.offsetParent){
                        oPos += obj.offsetTop;
                        obj = obj.offsetParent;
                }
                oPos=oPos-document.getElementById("MenuWrapper").offsetTop;
        }

        else if (obj.y)
                oPos += obj.y;
        
        return oPos;
}

function zeigVersteckIframe(el,v){
        layer=document.getElementById("Layer").style;
        ifrS=document.getElementById('killSelect').style;
        
        
        mouseoutLeft = findeL(el);
        mouseoutRight = findeL(el) + el.offsetWidth;
        mouseoutTop = findeO(el);
        mouseoutBottom = findeO(el) + el.offsetHeight;
        
        if(v=='visible'){
        
                
        layer.top=findeO(el)+'px';
        layer.left=findeL(el)+'px';
        layer.height=el.offsetHeight+'px';
        layer.width=el.offsetWidth+'px';        
        
        ifrS.top=findeO(el)+'px';
        ifrS.left=findeL(el)+'px';
        ifrS.height=el.offsetHeight+'px';
        ifrS.width=el.offsetWidth+'px';
        }
        ifrS.visibility=v;
        layer.visibilty=v
}
// menu ends