function keyBCheck(e,type){
	var error=false;
	var k = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
	if (k==32) return false;
	
	//alert(k);
	
	if(type=='string' || type=='alfa'){
		// çÇşŞığĞ
		if(k==231 || k==199 || k==351 || k==350 || k==304 || k==305 || k==287 || k==286 || k==252 || k==220 || k==246 || k==214){
			return true;
		}
	}	
	if (k.ctrlKey) return false;
	if (k==8) return true;
	
	if(type=='int' || type=='alfa'){
		//0-9
		if ((k>=48)&&(k<=57)) return true;
		else error=true;
	}
	if(type=='string' || type=='alfa'){	
		//A-Z
		if ((k>=65)&&(k<=90)) return true;
		else error=true;
		//a-z
		if ((k>=97)&&(k<=122)) return true;
		else error=true;
	}
	if (error==true) return false;
	else return true;
}
function selectAll(total,name){

	for(i=0;i<total;i++){
		
		document.getElementById(name+i).checked = true;   
    }		
	
}
function unSelectAll(total,name){

	for(i=0;i<total;i++){
		
		document.getElementById(name+i).checked = false;   
    }		
	
}
function rand( min, max ) {

    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
function wWindow(txt,id,w,h)
{
	w = parseInt(w) + 30;
	jsModelBasic(txt,w,h);
}
function myPostPager(p,formName){

	if(typeof p !="undefined"){
		eval("document."+ formName +".p.value="+p+";");
		eval("document."+ formName +".submit();");
	}
}
function swfString(g,h,b,l,o,w,he,swf){

	// if alternate swf specified use that one
	var swfFile = (typeof(swf)=="undefined")?"tip.swf":swf;
	if(typeof(w)=="undefined") var w = 60;
	if(typeof(he)=="undefined") var he = 90;
	var str="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\""
		+"codebase= \"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\""
		+"id=\"tip\" align=\"middle\" height=\""+he+"\" width=\""+w+"\">"
		+"<param name=\"allowScriptAccess\" value=\"sameDomain\">"
		+"<param name=\"movie\" value=\"/"+swfFile+"?gender="+g+"&amp;h="+h+"&amp;b="+b+"&amp;l="+l+"&amp;online="+((o=='online')?"online":"offline")+"\">"
		+"<param name=\"menu\" value=\"false\">"
		+"<param name=\"quality\" value=\"high\">"
		+"<param name=\"wmode\" value=\"transparent\">"
		+"<param name=\"bgcolor\" value=\"#ffffff\">"
		+"<embed src=\"/"+swfFile+"?gender="+g+"&amp;h="+h+"&amp;b="+b+"&amp;l="+l+"&amp;online="+((o=='online')?"online":"offline")+"\" "
		+"	menu=\"false\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" "
		+"	name=\"tip\" allowscriptaccess=\"sameDomain\" type=\"application/x-shockwave-flash\" "
		+"	pluginspage=\"https://www.macromedia.com/go/getflashplayer\" align=\"middle\" height=\""+he+"\" width=\""+w+"\" />"
		+"</object>";
	return str;		
}
function displayOrHide(id){
	var display = document.getElementById(id);
	if(display.style.display=='none') display.style.display='';
	else display.style.display='none';
	
/*		if (document.getElementById(id).visible()) 
		{
			new Effect.BlindUp(id,{duration: 0.5});
		}
		else 
		{
			new Effect.BlindDown(id,{duration: 0.3});	
		}*/
	
}

function chVis(id,on){ 
	var el = document.getElementById(id);
	if(typeof on == "undefined"){ el.style.display = (el.style.display=="block")?"none":"block"; return;}
	el.style.display = (on)?"block":"none"; 
}
function showImage(id){
	
	w = window.open("", "imageWin", "width=1,height=1,resizable=yes");		
	w.document.write("<html><head>")
	w.document.write("<sc" + "ript language='javascript'>\n");
	w.document.write("function fit(){\n");
	w.document.write("document.getElementById('ld').style.display='none';\n");		
	w.document.write("document.getElementById('im').style.display='block';\n");			
	w.document.write("var b = document.getElementById('bigPic');\n");				
	w.document.write("self.resizeTo(b.width+40,b.height+31+40);\n");		
	w.document.write("self.focus();\n");
	w.document.write("}\n");
	w.document.write("</s" + "cript>\n");
	w.document.write("<title>:: GAZOGEN ::</title></head><body bgcolor='#F8F3E9' style='margin:10px' onLoad='fit()'>\n");
	w.document.write("<center id='im' style='display:none;'><img name='bigPic' id='bigPic' src='/image.php?path="+id +"'></center>\n");
	w.document.write("<div id='ld' style='font-family:Arial,sans-serif;font-size:10px;'><img src='/images/animated_loading.gif'> &nbsp;Yükleniyor...</div>");					
	w.document.write("</body></html>");				
	w.document.close(); 	

}

	function MM_openBrWindow(theURL, winName, features) { //v2.0
	  window.open(theURL, winName, features);
	}
	
    function rooms(id,md5){
        if (screen.width < 1024){
            MM_openBrWindow('/gazosys/client.php?izoID='+id+'&key='+md5,'izogen','width=705,height=517,top=20,left=20,scrollbars=yes,location=no,menubar=no,resizable=yes,s tatus=no,directories=no,toolbar=no,buttons=no,titlebar=no')
        }else{
            MM_openBrWindow('/gazosys/client.php?izoID='+id+'&key='+md5,'izogen','width=975,height=647,top=20,left=20,scrollbars=yes,location=no,menubar=no,resizable=yes,s tatus=no,directories=no,toolbar=no,buttons=no,titlebar=no')
			
        }
        
    }

    function roomPopUp(type){
        if (screen.width < 1024){
            MM_openBrWindow('http://www.gazogen.com/gazosys/popUp.php?p=' + type,'izogen','width=705,height=517,top=20,left=20,scrollbars=yes,location=no,menubar=no,resizable=yes,s tatus=no,directories=no,toolbar=no,buttons=no,titlebar=no')
        }else{
            MM_openBrWindow('http://www.gazogen.com/gazosys/popUp.php?p=' + type,'izogen','width=975,height=647,top=20,left=20,scrollbars=yes,location=no,menubar=no,resizable=yes,s tatus=no,directories=no,toolbar=no,buttons=no,titlebar=no')
			
        }
        
    }
	
////
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

///
	
function myCounter(obj,field,max){
	max	= parseInt(max);
	if(max - obj.value.length < 0){
		obj.value = obj.value.substring(0,max);
		document.getElementById(field).value = 0;
	}else{
		document.getElementById(field).value = max - obj.value.length;
	}	
}	

// value = myReplace(value,"\n","<br>");
function myReplace(m,a,d)
{   
	if(m==null || a==null || m=='' || a=='') return m;   
	var m2;   
	for(;;)
	{   
		m2=m.replace(a,d);   
		if(m2==m)return m;   
		m=m2.replace(a,d);   
		if(m2==m)return m;   
	}   
}	
