var gie = document.all;
var gnn6 = document.getElementById && !document.all;
var reg_rep={" ":"_","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ó":"o","ś":"s","ż":"z","ź":"z"};

function dbi(ditem){
	return document.getElementById(ditem);
}

evtRegister=function(evtType,myFunc,adob){
	if(document.addEventListener){
		adob.addEventListener(evtType,myFunc,false);
	} else if (document.attachEvent) {
		adob.attachEvent('on'+evtType,myFunc);
	}
	return false;
}

function getWdSize() {
	
	var myWidth=0,myHeight=0;
	if(typeof(window.innerWidth)=='number') {
		//Non-IE
		myWidth=window.innerWidth;
		myHeight=window.innerHeight;
	}else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		myWidth=document.documentElement.clientWidth;
		myHeight=document.documentElement.clientHeight;
	}else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		//IE 4 compatible
		myWidth=document.body.clientWidth;
		myHeight=document.body.clientHeight;
  }
//  mywindow.width=myWidth;
//  mywindow.height=myHeight;
  return Array(myWidth,myHeight);
}

/***i getIframeDoc() wg. Brad Fults http://xkr.us/articles/dom/iframe-document/ **/
function getIframeDoc(iob){
	var doc=(iob.contentWindow || iob.contentDocument);
	if (doc.document) doc=doc.document;
	return doc;	
}

function udecode(mys){
	return 	unescape(decodeURI(mys));
}

function trimE(trimString){
	return trimString.split(" ").join("");
}

function chkmaxval(srcval,mymaxval){
	srcval.style.backgroundColor="";
	valtc=parseInt(srcval.value.split(" ").join(""));

	if(valtc && mymaxval>0 && valtc>mymaxval) valtc=mymaxval;

	if(valtc) srcval.value=formcell(String(valtc));

	if((!valtc && srcval.value.length>0) || (mymaxval!=0 && valtc>mymaxval) || (srcval.value.length>0 && wartoscreg.test(srcval.value)==false)) srcval.style.backgroundColor="#FF3333";
}

function replacer(str, p1, p2, offset, s){
	return reg_rep[str];
}

function chval(fid){
	myf=fid.value.match(/[a-z_ąęśćńłóżź\d\s]/g); //znaki mozliwe do wpisania
	if(myf && myf.join('')){
		myf=myf.join('');
		myf=myf.replace(/([ąęśćńłóżź\s])/g,replacer); //znaki mozliwe do wpisania podmieniane wedlug reg_rep  
		if(myf!=fid.value) fid.value=myf;
	} else {fid.value="";}
}

/*************
do powyzszej funkcji w razie potrzeby selection function =
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/forms/selection [v1.0]
**************/
/*
var element = document.getElementById( 'my_textarea' ); 
if( document.selection ){// The current selection
	var range = document.selection.createRange(); // We'll use this as a 'dummy'
	var stored_range = range.duplicate(); // Select all text
	stored_range.moveToElementText( element ); // Now move 'dummy' end point to end point of original range
	stored_range.setEndPoint( 'EndToEnd', range ); // Now we can calculate start and end points element.selection
	Start = stored_range.text.length - range.text.length;
	element.selectionEnd = element.selectionStart + range.text.length;
}
*/



/****************************************************->-end function-<-****************************************************/
