String.prototype.trim = function() {return this.replace(/^\s+|\s+$/g,"");};

//Id'si verilen combonun seçili value'sini döndürür.
function getComboValue(Id)
{
    var sel=getElm(Id);    
    return (sel.options.length>0)?sel.options[sel.selectedIndex].value:'';
};

//Verilen id'ye sahip elemeti döndürür.
function $(id){
    return document.getElementById(id);
};

//Verilen name'e sahip elemetleri döndürür. 
function $$(name){
    return document.getElementsByName(name);
};


function getElm(id){
   return (document.getElementById(id));	 
}; 

//Id'si verilen elementin değerini döndürür.
function getVal(id,byId){
    if(isEmpty(byId))byId=true;
    var elm=byId?$(id):$$(id)[0];
   
    if(elm){
        
        if(elm.tagName.toLowerCase()=='select' && elm.options.length>0)
            return elm.options[elm.selectedIndex].value;
        else 
            return elm.value;
    }
    return null;
};

function setVal(id,value){
    var elm=getElm(id);
    elm.value=value;
    return elm;    
};

//new Array('parametre1','parametre2'...) şeklinde ID'si verilen elementlerin değerlerini &parametre1=value1... formatında toplar.  
function collectData(params){
var str='';
for(var i=0;i<params.length;i++)
	str+='&'+params[i]+'='+encodeURIComponent(getVal(params[i]));
return str;	
};

//Belirtilen HTML objesini gizler.
function hide(elm){
if(elm){
	elm.style.visibility = "hidden";
	elm.style.position = "absolute";
	}
};

//Belirtilen HTML objesini gösterir.
function show(elm){
if(elm){
	elm.style.visibility = "visible";
	elm.style.position = "static";
	}
};

//Belirtilen HTML objesinin classını değiştirir.
function setClass(elm,cName){
	elm.setAttribute("className", cName);
    elm.setAttribute("class", cName); 
};

//Belirtilen HTML objesinin opacity'sini değiştirir.
function setOpacity(elm,ratio){
    elm.style.opacity=ratio/100;                      
    elm.style.MozOpacity=ratio/100;                   
    elm.style.filter='alpha(opacity='+ratio+')'; 
};

function IsASCII(str){
    return(/^[0-9A-Za-z]+$/.test(str));        
};
function checkEmail(id) {
    return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(getVal(id)));
};

function registerKeyPress(e,id){
    var keynum;

    if(window.event)
        keynum = e.keyCode;
    else
        if(e.which)
            keynum = e.which;
         
	if(keynum==13){ 
		getElm(id).click();
		return false;
	}
};

function isEmpty(obj){
    return((obj==null) || (obj=='undefined') || (obj==''));
};
 
function remove(Id){
    try{      
        var t = getElm(Id); 
        t.parentNode.removeChild(t);
    }catch(e){};
};

function msgBox(txt,title,type,grayOut,event,width,height,txtAlign){
    DWSWinObject=new DWSWin();
    type=type==null?winTypes.Ok:type;
    title=title==null?culture.term('msgBoxTitle'):title;

    if(title)DWSWinObject.title=title;
    if(txt)DWSWinObject.innerHTML=txt;
    if(type!=null)DWSWinObject.winType=type;
    if(grayOut!=null)DWSWinObject.grayOut=grayOut;
    if(event)DWSWinObject.onClose=event;
    if(!isEmpty(width))DWSWinObject.width=width;    
    if(!isEmpty(height))DWSWinObject.height=height;    
    if(!isEmpty(txtAlign))DWSWinObject.contentAlign=txtAlign; 

    DWSWinObject.show();
};
 
function isInArr(params,name,value){
    for(var i=0;i<params.length;i++)
    {
        if ( params[i].split('=')[0]==name && params[i].split('=')[1]==value)
        return true;
    }
    return false;
};

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
};

function requiredValidator(arr){
    return '';
};

function regExValidator(arr){
    return '';
};

enableCache();

function enableCache(){
try {
    document.execCommand("BackgroundImageCache", false, true);
} catch(err) {};
};
/*window.onerror = function(msg, url, line) {
    doJob('jslog','&filename='+encodeURIComponent(url.replace('.html','.$$$'))+'&message='+encodeURIComponent(msg)+'&linenumber='+line+'&browser='+ navigator.userAgent);
};*/




