function checkValues(temp){
if (temp.match(/^[-_a-zA-Z]{6,}?$/)) {
	return true 
	} 
else {
	return false
	}	
}

String.prototype.ltrim = function (){
	temp = this.toString().replace(/^[ \t\r\n]+/mg, "");
	return temp
	}
	
String.prototype.rtrim = function (){
	temp = this.toString().replace(/[ \t\r\n]+$/mg, "");
	return temp
	}	
	
	
String.prototype.trim = function (){
	temp=this.toString().ltrim();
	temp=temp.rtrim();
	return temp
	}
	
String.prototype.isEmpty=function(){
	txt = this.toString().replace(/(\r\n|\n)/g, "");
	return (txt.trim()=='')?true:false;
	}
	
String.prototype.isValidMail=function (){
	if (this.toString().match(/^[a-zA-Z0-9._%-]*@[a-zA-Z0-9._%-]*\.(?:[a-zA-Z0-9_%-]*(?:\.[A-Z0-9_%-a-z]{2,4})|[a-zA-Z0-9_%-]{2,4})$/)) return true 
	else return false
	}

String.prototype.isLikeUrl=function (){
	if (this.toString().match(/^(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]$/i)) return true 
	else return false
}

String.prototype.isValid=function (regExp){
	if (arguments.length>1) var strregexp = new RegExp(regExp,arguments[1]);
	else var strregexp = new RegExp(regExp);
	var match = strregexp.exec(this.toString());
	if (match != null) return true;
	else return false;
	}
String.prototype.isValidUsername=function (){
	if (this.toString().match(/^[a-zA-Z0-9]{6,14}$/)) return true
	else return false
	}

String.prototype.isValidPassword=function (){
	if (this.toString().match(/^[a-zA-Z0-9]{6,14}$/)) return true
	else return false
	}
String.prototype.isAnswer=function (){
	var myregexp = /[^\s]{4,}.*/;
	if (this.toString().match(myregexp)) return true;
	else return false;
}
String.prototype.isNumeric=function (){
	if (this.toString().match(/^[0-9]+$/)) return true;
	else return true	
	}	
String.prototype.isAlphaNumeric=function (){
	if (this.toString().match(/^[\w\d\s\.ığı?Üİ?ÇÖ]*$/)) return true;
	else return false;
	}
String.prototype.isValidDate=function (){
	if (this.toString().match(/^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.](19|20)[0-9]{2}$/)) return true;
	else return false;
	}	

String.prototype.isValidTime=function (){
	if (this.toString().match(/^([1-9]|1[0-9]|2[0-3]):[0-5][0-9]$/)) return true;
	else return false;
	}	

String.prototype.isValidData=function (){
	if (this.toString().match(/^[^'"\r\n]*$/)) return true;
	else return false;
	}	


String.prototype.isValidRouteAbbr=function (){
	if (this.toString().match(/^[A-Z]{3,5}$/i)) return true;
	else return false;
	}	

function allowed(list){
	CodeAscii=String.fromCharCode(window.event.keyCode);
	var strregexp = new RegExp("["+list+"]");
	var match = strregexp.exec(CodeAscii);
	if (match != null) return true;
	else return false;
	}

function wspace(obj){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return true;
	//0-9
	if ((window.event.keyCode>=48)&&(window.event.keyCode<=57)) return true;
	else hata=true;
	//A-Z
	if ((window.event.keyCode>=65)&&(window.event.keyCode<=90)) return true;
	else hata=true;
	//a-z
	if ((window.event.keyCode>=97)&&(window.event.keyCode<=122)) return true;
	else hata=true;
	if (hata==true) return false;
	else return true;
	}

function wospace(obj){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return false
	//0-9
	if ((window.event.keyCode>=48)&&(window.event.keyCode<=57)) return true;
	else hata=true;
	//A-Z
	if ((window.event.keyCode>=65)&&(window.event.keyCode<=90)) return true;
	else hata=true;
	//a-z
	if ((window.event.keyCode>=97)&&(window.event.keyCode<=122)) return true;
	else hata=true;
	if (hata==true) return false;
	else return true;
	}
	
function onlyalph(obj){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return true
	//A-Z
	if ((window.event.keyCode>=65)&&(window.event.keyCode<=90)) return true;
	else hata=true;
	//a-z
	if ((window.event.keyCode>=97)&&(window.event.keyCode<=122)) return true;
	else hata=true;
	if (hata==true) return false;
	else return true;
	}	
	
function onlynumbers(){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return false
	//0-9
	if ((window.event.keyCode>=48)&&(window.event.keyCode<=57)) return true;
	else hata=true;
	if (hata==true) return false;
	else return true;
	}	
function floatnumbers(){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return false
	//0-9
	
		if (((window.event.keyCode>=48)&&(window.event.keyCode<=57))||(window.event.keyCode==46)) {
			if ((window.event.keyCode==46)) {
				if (event.srcElement.value.indexOf('.')<0) return true
				else hata=false;
				}
			else return true;
			}
		else hata=true;

	if (hata==true) return false;
	else return true;
	}		
function nospace(obj){
	hata=false
	//Cancel Space
	if (window.event.keyCode==32) return false
	//0-9
	if (hata==true) return false;
	else return true;
	}	
	

function dateFirstBigger(a,b){
	c = Math.floor(new Date(b) - new Date(a)) / 86400000
	if (c>=0) return true;
	else return false;
	}
	
	
function changeToJsDate(subject){
		
	if (subject=='now') {
		now=new Date()
		subject=now.getDate()+'/'+now.getMonth()+'/'+now.getFullYear()
		}
	result = subject.replace(/^([0-9]{1,2})[.\/\-\_]([0-9]{1,2})[.\/\-\_]([0-9]{4})$/g, "$3/$2/$1");
	//alert(result)
	return result;
	}
	
function findAge(dateofbirth){
	now = new Date()
	bdate=changeToJsDate(dateofbirth)
	born = new Date(bdate);
	
	by=born.getFullYear()
	bm=born.getMonth()
	bd=born.getDate()
	
	ny=now.getFullYear()
	nm=now.getMonth()
	nd=now.getDate()
	
	years=ny-by

	if((bm == nm) && (bd <= nd)) years = years;
	else {
		if(bm <= nm) years = years-1;
		else years = years; 
		}
	
	return years		
	
	}
function isPopUpsBlocked(){
	var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
	if(mine) popUpsBlocked = false
	else popUpsBlocked = true
	mine.close();
	return popUpsBlocked;
}


function passwordStrength(pass){
	strength=0;
	if (pass.match(/[a-z]+/)) strength++;
	if (pass.match(/[0-9]+/)) strength++;
	if (pass.match(/[A-Z]+/)) strength++;
	return strength;
	}
	
function leapyear(a) {
	if(((a % 4 == 0) && (a % 100 != 0)) || (a % 400 == 0)) return true;
	else return false;
	}
function isRadioChecked(obj){
	if (typeof(obj)=="undefined") return false;
	for(i=0;i<obj.length;i++){
		if (obj[i].checked) return true;
		}
	return false;
	}
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';
  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":

	  case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "session":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = ret.embedAttrs["src"]+'?id='+args[i+1];
        ret.params[srcParamName] = ret.params[srcParamName]+'?id='+args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
function getY(obj){
   return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}
function getX(obj){
   return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}
function removeRows(elem){
	if (elem.children.length>0) {
		elem.children[0].removeNode(true);
		removeRows(elem);
	}
	else return true;
	return false;
}
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
function Browser(){   
	this.name = navigator.appName;  
	this.codename = navigator.appCodeName;  
	this.version = navigator.appVersion.substring(0,4);   
	this.platform = navigator.platform;   
	this.javaEnabled = navigator.javaEnabled();  
	this.cookieEnabled = navigator.cookieEnabled;   
	this.userAgent = navigator.userAgent;   
	this.screenWidth = screen.width;   
	this.screenHeight = screen.height;   
	this.loc = window.location.href;  
	this.referrer = (document.referrer)? document.referrer : "Direct";   
	this.charSet = (document.characterSet)? document.characterSet : document.charset;  
	this.language = (navigator.language)? navigator.language : navigator.browserLanguage;  
	this.information = function(){
		info = "\n== Client Descriptions ==\n"; 
		info += "Application Name is: " + this.name + "\n";
		info += "Application Code name is: " + this.codename + "\n"; 
		info += "Application Version is: " + this.version + "\n";  
		info += "Location: " + this.loc + "\n";    
		info += "Referrer: " + this.referrer + "\n";  
		info += "User agent: " + this.userAgent + "\n";    
		info += "Platform is: " + this.platform + "\n";  
		info += "Is java Enabled?: " + this.javaEnabled + "\n";  
		info += "Is Cookie Enabled?:" + this.cookieEnabled + "\n"; 
		info += "Language: " + this.language + "\n"; 
		info += "Document Character Set: " + this.charSet + "\n";  
		info += "Client screenWidth: " + this.screenWidth + "\n"; 
		info += "Client screenHeight: " + this.screenHeight + "\n";   
		return info;   
	}  
}
var alr=null;
function showAlert(aTitle,aText,focusObj){
	alr=new alerter('alr');
	alr.setTitle(aTitle);
	alr.setText(aText);
	alr.focusObj(focusObj||null);
	alr.show();
}
function closeBtn(){
	alr.closeBtn();
	//document.getElementById('alert').style.display='none';
}
function alerter(objName){
	this.button="ok";
	this.object=objName;
	this.alertName='alerter';
	createAlertBox();
	var objNameToFocus=null;
	this.focusObj=function(obj){
		this.objNameToFocus=obj||null;
	}	
	this.show=function(){
		if(document.getElementById('alert')==null) createAlertBox();
		var alrObj=document.getElementById('alert');
		dWidth=document.body.clientWidth;
		dHeight=document.body.clientHeight;
		alrObj.style.display='';
		aWidth=alrObj.offsetWidth;
		aHeight=alrObj.offsetHeight;
		aLeft=parseInt((dWidth-aWidth)/2);
		aTop=parseInt((dHeight-aHeight)/2);
		alrObj.style.left=aLeft;
		alrObj.style.top=aTop;
	}
	this.closeBtn=function(){
		if(this.objNameToFocus!=null) this.objNameToFocus.focus();
		document.getElementById('alert').style.display='none';
	}
	this.setTitle=function(txt){
		if(document.getElementById('alert')==null) createAlertBox();
		document.getElementById('alertTitle').innerText=txt;
	}
	this.setText=function(txt){
		if(document.getElementById('alert')==null) createAlertBox();
		document.getElementById('alertText').innerHTML=txt;
		document.getElementById('alertButtons').innerHTML='<input type="button" style="width:80px;" value="Ok" onclick="closeBtn();"/>';
	}	
	function createAlertBox(){
		if(document.getElementById('alert')==null){
			var instanceOfObj=this
			var alertDiv=document.createElement('DIV');
			alertDiv.id="alert";
			//SHADOW
			var newObj=document.createElement('DIV');
			newObj.className="shadow";
			alertDiv.appendChild(newObj);
			//TOP BAR
			var newObj=document.createElement('DIV');
			newObj.id="alertTop";
			var slObj=document.createElement('DIV');
			slObj.id="left";
			newObj.appendChild(slObj);	
			var slObj=document.createElement('DIV');
			slObj.id="right";
			newObj.appendChild(slObj);
			var slObj=document.createElement('DIV');
			slObj.id="alertTitle";
			slObj.unselectable="on";
			newObj.appendChild(slObj);			
			var slObj=document.createElement('A'); 
			slObj.id="closeBtn";
			slObj.href="javascript:void(0);closeBtn();";
			var imgObj=document.createElement('IMG'); 
			imgObj.src="../images/spacer.gif";			
			imgObj.border="0";
			slObj.appendChild(imgObj);
			newObj.appendChild(slObj);
			alertDiv.appendChild(newObj);
			
			//MIDDLE
			var newObj=document.createElement('DIV');
			newObj.id="alertMain";
			var slObj=document.createElement('DIV');
			slObj.id="left";
			newObj.appendChild(slObj);	
			var slObj=document.createElement('DIV');
			slObj.id="right";
			newObj.appendChild(slObj);
			var slObj=document.createElement('DIV');
			slObj.id="alertText";
			slObj.unselectable="on";
			newObj.appendChild(slObj);			
			var slObj=document.createElement('DIV');
			slObj.id="alertButtons";	
			slObj.unselectable="on";
			newObj.appendChild(slObj);				
			alertDiv.appendChild(newObj);
			
			//BOTTOM
			var newObj=document.createElement('DIV');
			newObj.id="alertBottom";
			var slObj=document.createElement('DIV');
			slObj.id="left";
			newObj.appendChild(slObj);	
			var slObj=document.createElement('DIV');
			slObj.id="right";
			newObj.appendChild(slObj);
			var slObj=document.createElement('DIV');
			slObj.id="bottomLine";
			newObj.appendChild(slObj);			
			alertDiv.appendChild(newObj);			
			document.body.appendChild(alertDiv);
		}		
	}
}
