/*#############################################################
Name: Niceforms
Version: 2.0
Author: Lucian Slatineanu
URL: http://www.emblematiq.com/projects/niceforms/

Feel free to use and modify but please this copyright intact.
#############################################################*/


function changelanguage(pageadr) {
	alert(pageadr);
	var linka = pageadr;
 setTimeout("dochangelanguage('"+linka+"');", 50);
} 

function dochangelanguage(pageadr)
{
		//marek modif. http://www.cs2.ch/support/view.php?id=34684
		var myform = document.getElementById('sr_language_menu_select');
		//if(myform.options[myform.selectedIndex].value != '0') 
		//{ 
		//		top.location.replace(pageadr + myform.options[myform.selectedIndex].value); 
		//} else { 
			top.location.replace(pageadr); 
		//}	
}




	



//Theme Variables - edit these to match your theme
var imagesPath = "fileadmin/templates/pics/";
var selectRightWidthSimple = 19;
var selectRightWidthScroll = 11;
var selectMaxHeight = 200;
var textareaTopPadding = 10;
var textareaSidePadding = 10;

//Global Variables
var NF = new Array();
var isIE = false;
var resizeTest = 1;


//Initialization function
function NFInit() {

	try {
		document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}
	if(!document.getElementById) {return false;}
	//alert("click me first");
	NFDo('start');
}
function NFDo(what) {
	//alert(what);
	var niceforms = document.getElementsByTagName('form');
	var identifier = new RegExp('(^| )'+'niceform'+'( |$)');
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		var ieversion=new Number(RegExp.$1);
		//if(ieversion < 7) {supersleight.run();} //exit script if IE6
		isIE = true;
	}
	for(var q = 0; q < niceforms.length; q++) {if(identifier.test(niceforms[q].className)) {
		if(what == "start") { //Load Niceforms
			NF[q] = new niceform(niceforms[q]);
			niceforms[q].start();
		}
		else { //Unload Niceforms
			niceforms[q].unload();
			NF[q] = "";
		}
	}}
	//if(ieversion < 7) { supersleight.run(); } //exit script if IE6			
}
function NFFix() {
	NFDo('stop');
	NFDo('start');
}
function niceform(nf) {
	nf._inputText = new Array(); nf._inputRadio = new Array(); nf._inputCheck = new Array(); nf._inputSubmit = new Array(); nf._inputFile = new Array(); nf._textarea = new Array(); nf._select = new Array(); nf._multiselect = new Array();
	nf.add_inputText = function(obj) {this._inputText[this._inputText.length] = obj; inputText(obj);}
	nf.add_inputCheck = function(obj) {this._inputCheck[this._inputCheck.length] = obj; inputCheck(obj);}
	nf.add_inputSubmit = function(obj) {this._inputSubmit[this._inputSubmit.length] = obj; inputSubmit(obj);}
	nf.add_inputFile = function(obj) {this._inputFile[this._inputFile.length] = obj; inputFile(obj);}
	nf.add_textarea = function(obj) {this._textarea[this._textarea.length] = obj; textarea(obj);}
	nf.add_inputRadio = function(obj) {this._inputRadio[this._inputRadio.length] = obj; inputRadio(obj);}		
	nf.add_select = function(obj) {this._select[this._select.length] = obj; selects(obj);}
	nf.add_multiselect = function(obj) {this._multiselect[this._multiselect.length] = obj; multiSelects(obj);}
	nf.start = function() {
		//Separate and assign elements
		var allInputs = this.getElementsByTagName('input');
		for(var w = 0; w < allInputs.length; w++) {
			switch(allInputs[w].type) {
				case "text": case "password": {this.add_inputText(allInputs[w]); break;}
				case "checkbox": {this.add_inputCheck(allInputs[w]); break;}
				case "submit": case "reset": case "button": {this.add_inputSubmit(allInputs[w]); break;}
				case "file": {this.add_inputFile(allInputs[w]); break;}
				case "radio": {this.add_inputRadio(allInputs[w]); break;}				
			}
		}
		
		var allButtons = this.getElementsByTagName('button');
		for(var w = 0; w < allButtons.length; w++) {
			this.add_inputSubmit(allButtons[w]);
		}
		
		var allTextareas = this.getElementsByTagName('textarea');
		for(var w = 0; w < allTextareas.length; w++) {
			this.add_textarea(allTextareas[w]);
		}
		var allSelects = this.getElementsByTagName('select');
		for(var w = 0; w < allSelects.length; w++) {
			if(allSelects[w].size == "1") {this.add_select(allSelects[w]);}
			else {this.add_multiselect(allSelects[w]);}
		}
		
		
		//Start
		for(w = 0; w < this._inputText.length; w++) {this._inputText[w].init();}
		for(w = 0; w < this._inputCheck.length; w++) {this._inputCheck[w].init();}
		for(w = 0; w < this._inputSubmit.length; w++) {this._inputSubmit[w].init();}
		for(w = 0; w < this._inputFile.length; w++) {this._inputFile[w].init();}
		for(w = 0; w < this._textarea.length; w++) {this._textarea[w].init();}
		for(w = 0; w < this._inputRadio.length; w++) {this._inputRadio[w].init();}				
		for(w = 0; w < this._select.length; w++) {this._select[w].init(w);}
		for(w = 0; w < this._multiselect.length; w++) {this._multiselect[w].init(w);}

	}
	nf.unload = function() {
		//Stop
		
		for(w = 0; w < this._inputText.length; w++) {this._inputText[w].unload();}
		for(w = 0; w < this._inputCheck.length; w++) {this._inputCheck[w].unload();}
		for(w = 0; w < this._inputSubmit.length; w++) {this._inputSubmit[w].unload();}
		for(w = 0; w < this._inputFile.length; w++) {this._inputFile[w].unload();}
		for(w = 0; w < this._textarea.length; w++) {this._textarea[w].unload();}
		for(w = 0; w < this._inputRadio.length; w++) {this._inputRadio[w].unload();}						
		for(w = 0; w < this._select.length; w++) {this._select[w].unload();}
		for(w = 0; w < this._multiselect.length; w++) {this._multiselect[w].unload();}
		
	}
}
function inputText(el) { //extent Text inputs
	el.oldClassName = el.className;
	el.left = document.createElement('div');
	////el.left.src = imagesPath + "0.png";
	el.left.className = "NFTextLeft";
	el.right = document.createElement('div');
	////el.right.src = imagesPath + "0.png";
	el.right.className = "NFTextRight";
	el.dummy = document.createElement('div');
	el.dummy.className = "NFTextCenter";

	el.dummy.style.width = el.offsetWidth+'px';

	var identifier = new RegExp('(^| )'+'niceform'+'( |$)');
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {	
//	var ieversion=new Number(RegExp.$1);
	if(ieversion < 8) 
			el.dummy.style.width = el.style.width;	
	}

	el.onfocus = function() {
		////this.dummy.className = "NFTextCenter NFh";
		////this.left.className = "NFTextLeft NFh";
		////this.right.className = "NFTextRight NFh";
	}
	el.onblur = function() {
		////this.dummy.className = "NFTextCenter";
		////this.left.className = "NFTextLeft";
		////this.right.className = "NFTextRight";
	}
	el.init = function() {
		this.parentNode.insertBefore(this.left, this);
		this.parentNode.insertBefore(this.right, this.nextSibling);
		this.dummy.appendChild(this);
		this.right.parentNode.insertBefore(this.dummy, this.right);
		this.className = "NFText";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.left);
		this.parentNode.removeChild(this.right);
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
}
function inputRadio(el) { //extent Radio buttons
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummytop = document.createElement('div');	
	el.dummytop.className = "NFhra";
	el.dummy.className = "NFRadio";
	
	if(el.checked) {
			//el.dummy.className = "NFRadio NFhra";
			el.dummy.style.display= 'none';
			el.dummytop.style.display= 'block';			
			//el.dummy.className = "NFhra";			
	}
	else {//el.dummy.className = "NFRadio"; 
			el.dummy.style.display= 'block';
			el.dummytop.style.display= 'none';						
		}
	el.dummy.ref = el;
	////if(isIE == false) {el.dummy.style.left = findPosX(el) + 'px'; el.dummy.style.top = findPosY(el) + 'px';}
////	else {el.dummy.style.left = findPosX(el) + 4 + 'px'; el.dummy.style.top = findPosY(el) + 4 + 'px';}
	el.dummy.onclick = function() {
		if(!this.ref.checked) {
			var siblings = getInputsByName(this.ref.name);
			for(var q = 0; q < siblings.length; q++) {
				siblings[q].checked = false;
				///siblings[q].dummy.className = "NFRadio";
				siblings[q].dummy.style.display = "block";
				siblings[q].dummytop.style.display = "none";								
			}
			this.ref.checked = true;
			//this.className = "NFRadio NFhra";
			//this.className = "NFhra";			
			this.style.display= 'none';
	    el.dummytop.style.display= 'block';			
			
		}
	}
	el.onclick = function() {
		if(this.checked) {
			var siblings = getInputsByName(this.name);
			for(var q = 0; q < siblings.length; q++) {
				//siblings[q].dummy.className = "NFRadio";
				siblings[q].dummy.style.display = "block";	
				siblings[q].dummytop.style.display = "none";				
			}
			//this.dummy.className = "NFRadio NFhra";
			//this.className = "NFhra";			
			this.style.display= 'none';
	    el.dummytop.style.display= 'block';						
		}
	}
	//el.onfocus = function() {this.dummy.className += " NFfocused";}
	//el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.init = function() {
		this.parentNode.insertBefore(this.dummy, this);
		this.parentNode.insertBefore(this.dummytop, this);		
		el.className = "NFhidden";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.parentNode.removeChild(this.dummytop);		
		this.className = this.oldClassName;
	}
}
function inputCheck(el) { //extend Checkboxes
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	////el.dummy.src = imagesPath + "0.png";
	el.dummytop = document.createElement('div');	
	el.dummytop.className = "NFhrc";
	el.dummy.className = "NFCheck";

  el.dummy.ref = el;	
  el.dummytop.ref = el;	
	
	if(el.checked) {
		//el.dummy.className = "NFhrc";
	    el.dummy.style.display= 'none';		
	    el.dummytop.style.display= 'block';
	    //el.dummytop.ref = el;	
	}
	else {
		//el.dummy.className = "NFCheck";
	    el.dummy.style.display= 'block';		
	    el.dummytop.style.display= 'none';		
	    //el.dummy.ref = el;		    
	}


//if(isIE == false) {el.dummy.style.left = findPosX(el) + 'px'; el.dummy.style.top = findPosY(el) + 'px';}
////	else {el.dummy.style.left = findPosX(el) + 4 + 'px'; el.dummy.style.top = findPosY(el) + 4 + 'px';}

el.dummy.onclick = function() {
		if(!this.ref.checked) {
			this.ref.checked = true;
	
			this.style.display = "none";				
			el.dummytop.style.display= 'block';	
   
			///this.className = "NFhrc";
		}
		else {
			this.ref.checked = false;
			this.style.display = "block";
	    el.dummytop.style.display= 'none';					
			//this.className = "NFCheck";
		}
	}
	
el.dummytop.onclick = function() {
		if(!this.ref.checked) {
			this.ref.checked = true;
	
			this.style.display = "block";				
			el.dummy.style.display= 'none';	
   
			///this.className = "NFhrc";
		}
		else {
			this.ref.checked = false;
			this.style.display = "none";
	    el.dummy.style.display= 'block';					
			//this.className = "NFCheck";
		}
	}	

	el.onclick = function() {
		if(this.checked) {
			this.dummy.className = "NFhrc";
	    	//this.dummy.style.display= 'none';		
	    	//this.dummytop.style.display= 'block';	
			
		}
		else {
			this.dummy.className = "NFCheck";
	    //this.dummy.style.display= 'block';		
	    //this.dummytop.style.display= 'none';					
		}
	}
	
//	el.onfocus = function() {this.dummy.className += " NFfocused";}
//	el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.init = function() {
		this.parentNode.insertBefore(this.dummy, this);
		this.parentNode.insertBefore(this.dummytop, this);		
		el.className = "NFhidden";
	} 
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.parentNode.removeChild(this.dummytop);		
		this.className = this.oldClassName;
	}
}
function inputSubmit(el) { //extend Buttons
	el.oldClassName = el.className;
	el.left = document.createElement('div');
	el.left.className = "NFButtonLeft";	
	
	if(el.id == "specialsearch")
		el.left.className = "NFButtonLeftspc";
	////el.left.src = imagesPath + "0.png";
	el.right = document.createElement('div');
	////el.right.src = imagesPath + "0.png";
	el.right.className = "NFButtonRight";
	el.onmouseover = function() {
		this.className = "NFButton NFh";
		this.left.className = "NFButtonLeft NFh";
		if(el.id == "specialsearch")		
			this.left.className = "NFButtonLeftspc NFh";
				
		this.right.className = "NFButtonRight NFh";
	}
	el.onmouseout = function() {
		this.className = "NFButton";
		this.left.className = "NFButtonLeft";
		if(el.id == "specialsearch")		
			this.left.className = "NFButtonLeftspc";		
		this.right.className = "NFButtonRight";
	}
	el.init = function() {
		this.parentNode.insertBefore(this.left, this);
		this.parentNode.insertBefore(this.right, this.nextSibling);
		this.className = "NFButton";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.left);
		this.parentNode.removeChild(this.right);
		this.className = this.oldClassName;
	}
}

function inputFilexxxx(el) { //extend File inputs
	
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummy.className = "NFFile";
	el.file = document.createElement('div');
	el.file.className = "NFFileNew";
	el.center = document.createElement('div');
	el.center.className = "NFTextCenter";
	el.clone = document.createElement('input');
	el.clone.type = "text";
	el.clone.className = "NFTextfile";
	el.clone.ref = el;
	el.left = document.createElement('img');
	//el.left.src = imagesPath + "0.png";
	el.left.src = "clear.gif";
	el.left.className = "NFTextLefts";
	
	
	el.button = document.createElement('input');

	el.button.type = "button";
	var temp = document.getElementById('filebutton');
	
	el.button.value = temp.value;
	//el.button.src = imagesPath + "0.png";
	//el.button.src = "clear.gif";
	el.button.className = "NFFileButton";
	el.button.ref = el;
	
	
	el.button.onclick = function() {this.ref.click();}
	
	el.center.style.width = '201px';



	

	//el.buttext = document.createElement('div');
	//el.buttext.className = "NFButttext";
	//el.buttext.innerHTML = "";
	
	el.init = function() {
		
		alert('init');
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(this.dummy, where);
		this.dummy.appendChild(this);
		this.center.appendChild(this.clone);
		this.file.appendChild(this.center);
		this.file.insertBefore(this.left, this.center);
		this.file.appendChild(this.button);
		this.dummy.appendChild(this.file);
		this.className = "NFhidden";
		this.relatedElement = this.clone;
	}
	el.unload = function() {
		alert('unload');
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
	el.onchange = el.onmouseout = function() {
		alert('onchange');
		this.relatedElement.value = this.value;
	}
	el.onfocus = function() {
		alert('onfocus');
//		this.left.className = "NFTextLefts";
//		this.center.className = "NFTextCenter";
//		this.button.className = "NFFileButton";

		//this.left.className = "NFTextLeft NFh";
		//this.center.className = "NFTextCenter NFh";
		//this.button.className = "NFFileButton NFh";		
	}
	el.onblur = function() {
		alert('onblur');
//		this.left.className = "NFTextLefts";
//		this.center.className = "NFTextCenter";
//		this.button.className = "NFFileButton";
	}
	el.onselect = function() {
		alert('onselect');
	//	this.relatedElement.select();
	//	this.value = '';
	}
}

function inputFile(el) { //extend File inputs
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummy.className = "NFFile";
	el.file = document.createElement('div');
	el.file.className = "NFFileNew";
	el.center = document.createElement('div');
	el.center.className = "NFTextCenter";
	el.clone = document.createElement('input');
	el.clone.type = "text";
	el.clone.className = "NFTextfile";
	el.clone.ref = el;
	el.left = document.createElement('img');
	//el.left.src = imagesPath + "0.png";
	el.left.src = "clear.gif";
	el.left.className = "NFTextLefts";
	
	el.button = document.createElement('input');

	el.button.type = "button";
	var temp = document.getElementById('filebutton');
	
	el.button.value = temp.value;
	//el.button.src = imagesPath + "0.png";
	//el.button.src = "clear.gif";
	el.button.className = "NFFileButton";
	el.button.ref = el;	
	
	
	//el.button = document.createElement('img');
	//el.button.src = imagesPath + "0.png";
	//el.button.className = "NFFileButton";
	//el.button.ref = el;
	
	
	//el.button.onclick = function() {this.ref.click();}
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(this.dummy, where);
		this.dummy.appendChild(this);
		this.center.appendChild(this.clone);
		this.file.appendChild(this.center);
		this.file.insertBefore(this.left, this.center);
		this.file.appendChild(this.button);
		this.dummy.appendChild(this.file);
		this.className = "NFhiddenfile";
		this.relatedElement = this.clone;
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
	el.onchange = el.onmouseout = function() {this.relatedElement.value = this.value;}
	el.onfocus = function() {
		this.left.className = "NFTextLeft NFh";
		this.center.className = "NFTextCenter NFh";
		this.button.className = "NFFileButton NFh";
	}
	el.onblur = function() {
		this.left.className = "NFTextLeft";
		this.center.className = "NFTextCenter";
		this.button.className = "NFFileButton";
	}
	el.onselect = function() {
		this.relatedElement.select();
		this.value = '';
	}
}


function textarea(el) { //extend Textareas
	el.oldClassName = el.className;
	el.height = el.offsetHeight - textareaTopPadding;
	el.width = el.offsetWidth - textareaSidePadding;

	el.topLeftout = document.createElement('div');
	el.topLeftout.className = "NFTextareaTopLeftout";

	el.topLeft = document.createElement('div');
	////el.topLeft.src = imagesPath + "0.png";
	el.topLeft.className = "NFTextareaTopLeft";
	
	el.topLefin = document.createElement('div');
	////el.topLefin.src = imagesPath + "0.png";

	el.topRight = document.createElement('div');
	el.topRight.className = "NFTextareaTop";

	el.topRightin = document.createElement('div');
	el.topRightin.className = "NFTextareaTopin";	
	
	el.topRightout = document.createElement('div');
	el.topRightout.className = "NFTextareaTopout";		
	
	////////////////////////////////////////////////
	
	el.bottomLeftout = document.createElement('div');
	el.bottomLeftout.className = "NFTextareaBottomLeftout";	
	
	el.bottomLeft = document.createElement('div');
	////el.bottomLeft.src = imagesPath + "0.png";
	el.bottomLeft.className = "NFTextareaBottomLeft";
	
	el.bottomLefin = document.createElement('div');
	////el.bottomLefin.src = imagesPath + "0.png";	
		
	el.bottomRight = document.createElement('div');
	el.bottomRight.className = "NFTextareaBottom";
	
	el.bottomRightin = document.createElement('div');
	el.bottomRightin.className = "NFTextareaBottomin";		
	
	el.bottomRightout = document.createElement('div');
	el.bottomRightout.className = "NFTextareaBottomout";			
	
	el.left = document.createElement('div');
	el.left.className = "NFTextareaLeft";
	el.right = document.createElement('div');
	el.right.className = "NFTextareaRight";
	
	el.rightout = document.createElement('div');
	el.rightout.className = "NFTextareaRightout";
		
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
			
		top.insertBefore(el.topRight, where);
		top.insertBefore(el.right, where);
		top.insertBefore(el.rightout, where);
				
		top.insertBefore(el.bottomRight, where);
		
		this.topRight.appendChild(this.topLeftout);
		
		this.topLeftout.appendChild(this.topLeft);		
		this.topRight.appendChild(this.topRightin);
		this.topRight.appendChild(this.topRightout);				
		this.topRightin.appendChild(this.topLefin);		


		this.right.appendChild(this.left);
		this.right.appendChild(this);
		////this.right.appendChild(this.rightout);
		
		this.bottomRight.appendChild(this.bottomLeftout);
		this.bottomLeftout.appendChild(this.bottomLeft);
		this.bottomRight.appendChild(this.bottomRightin);
		this.bottomRight.appendChild(this.bottomRightout);		
		this.bottomRightin.appendChild(this.bottomLefin);
		
		//el.topRight.style.width = el.bottomRight.style.width = 
		el.topRightin.style.width = el.bottomRightin.style.width = el.width  + 'px';

		el.style.width = el.width + 'px';
		el.style.height = el.left.style.height = el.right.style.height = el.rightout.style.height = el.height + 'px';		
		
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
			var ieversion=new Number(RegExp.$1);
			if(ieversion < 7)
			{
				el.topRightin.style.width = el.bottomRightin.style.width = el.offsetWidth + 'px';
				el.left.style.height = el.offsetHeight + 'px';				
			}
			else
				el.topRightin.style.width = el.bottomRightin.style.width = el.width + 'px';
		}
		

		this.className = "NFTextarea";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.topRight);
		this.parentNode.removeChild(this.bottomRight);
		this.parentNode.removeChild(this.right);
		this.parentNode.removeChild(this.rightout);		
		this.className = this.oldClassName;
		this.style.width = this.style.height = "";
	}
	el.onfocus = function() {
//		this.topLeft.className = "NFTextareaTopLeft NFh";
	//	this.topRight.className = "NFTextareaTop NFhr";
		//this.left.className = "NFTextareaLeftH";
		//this.right.className = "NFTextareaRightH";
//		this.bottomLeft.className = "NFTextareaBottomLeft NFh";
//		this.bottomRight.className = "NFTextareaBottom NFhr";
	}
	el.onblur = function() {
//		this.topLeft.className = "NFTextareaTopLeft";
//		this.topRight.className = "NFTextareaTop";
//		this.left.className = "NFTextareaLeft";
//		this.right.className = "NFTextareaRight";
//		this.bottomLeft.className = "NFTextareaBottomLeft";
//		this.bottomRight.className = "NFTextareaBottom";
	}
}
function selects(el) { //extend Selects
	el.oldClassName = el.className;
	el.dummy = document.createElement('div');
	el.dummy.className = "NFSelect";
	
	el.style.width = el.offsetWidth + 'px';  //tu

	if(el.offsetWidth	< 80)
		el.style.width = el.offsetWidth + 30 + 'px';  //tu
			
	el.dummy.ref = el;
	
	//el.left = document.createElement('div');
	el.left = document.createElement('img');	
	el.left.src = "clear.gif";
	el.left.className = "NFSelectLeft";
	
	el.rightout = document.createElement('img');	
	el.rightout.src = "clear.gif";
	el.rightout.className = "NFSelectRightout";	
	
	el.right = document.createElement('div');
	el.right.className = "NFSelectRight";
	
	el.right.style.width = el.offsetWidth - 30 + 'px';
	
	
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
			var ieversion=new Number(RegExp.$1);
			if(ieversion < 7)
				el.right.style.width = el.offsetWidth - 34  + 'px';
			else
				el.right.style.width = el.offsetWidth - 30  + 'px';
		}	
	
	
	el.txt = document.createTextNode(el.options[0].text);
	el.bg = document.createElement('div');
	el.bg.className = "NFSelectTarget";

	//el.bg.style.width = el.offsetWidth + 30 + 'px';	
	
	el.bg.style.display = "none";
	el.opt = document.createElement('ul');
	el.opt.className = "NFSelectOptions";
	////el.dummy.style.left = findPosX(el) + 'px';
	////el.dummy.style.top = findPosY(el) + 'px';
	el.opts = new Array(el.options.length);
	el.init = function(pos) {
		//this.left.appendChild(this.leftin);
		this.dummy.appendChild(this.left);
		this.right.appendChild(this.txt);
		this.dummy.appendChild(this.right);
		this.dummy.appendChild(this.rightout);		
		this.bg.appendChild(this.opt);
		this.dummy.appendChild(this.bg);
		if(this.options.selectedIndex) {this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[this.options.selectedIndex].text;}
		for(var q = 0; q < this.options.length; q++) {
			this.opts[q] = new option(this.options[q], q);
			this.opt.appendChild(this.options[q].li);
			this.options[q].lnk.onclick = function() {
				this._onclick();
				this.ref.dummy.getElementsByTagName('div')[0].innerHTML = this.ref.options[this.pos].text;
				//this.ref.dummy.getElementsByTagName('div').innerHTML = this.ref.options[this.pos].text;
				this.ref.options[this.pos].selected = "selected";

			}
		}
		this.dummy.style.zIndex = 999 - pos;
		this.parentNode.insertBefore(this.dummy, this);
		this.className = "NFhidden";
	}
	el.unload = function() {
		this.parentNode.removeChild(this.dummy);
		this.className = this.oldClassName;
	}
	el.dummy.onclick = function() {
		var allDivs = document.getElementsByTagName('div'); for(var q = 0; q < allDivs.length; q++) {if((allDivs[q].className == "NFSelectTarget") && (allDivs[q] != this.ref.bg)) {allDivs[q].style.display = "none";}}
		if(this.ref.bg.style.display == "none") {
			this.ref.bg.style.display = "block";
			this.ref.bg.style.zIndex = "9999";
			
			}
		else {this.ref.bg.style.display = "none";}
		if(this.ref.opt.offsetHeight > selectMaxHeight) {
			this.ref.bg.style.width = this.ref.offsetWidth - selectRightWidthScroll + 37 + 'px';
			//this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthScroll + 4 + 'px';
			this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthScroll - 2 + 'px';			
		}
		else {
			this.ref.bg.style.width = this.ref.offsetWidth - selectRightWidthSimple + 37 + 'px';
			//this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthSimple + 4 + 'px';
			this.ref.opt.style.width = this.ref.offsetWidth - selectRightWidthSimple  + -2 +'px';			
		}
	}
	el.bg.onmouseout = function(e) {
		if (!e) var e = window.event;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if((reltg.nodeName == 'A') || (reltg.nodeName == 'LI') || (reltg.nodeName == 'UL')) return;
		if((reltg.nodeName == 'DIV') || (reltg.className == 'NFSelectTarget')) return;
		else{this.style.display = "none";}
	}
	el.dummy.onmouseout = function(e) {
		if (!e) var e = window.event;
		e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if((reltg.nodeName == 'A') || (reltg.nodeName == 'LI') || (reltg.nodeName == 'UL')) return;
		if((reltg.nodeName == 'DIV') || (reltg.className == 'NFSelectTarget')) return;
		else{this.ref.bg.style.display = "none";}
	}
	
	
	
//	el.onfocus = function() {this.dummy.className += " NFfocused";}
	//el.onblur = function() {this.dummy.className = this.dummy.className.replace(/ NFfocused/g, "");}
	el.onkeydown = function(e) {
		if (!e) var e = window.event;
		var thecode = e.keyCode;
		var active = this.selectedIndex;
		switch(thecode){
			case 40: //down
				if(active < this.options.length - 1) {
					var newOne = active + 1;
					this.options[newOne].selected = "selected";
					this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[newOne].text;
				}
				break;
			case 38: //up
				if(active > 0) {
					var newOne = active - 1;
					this.options[newOne].selected = "selected";
					this.dummy.getElementsByTagName('div')[0].innerHTML = this.options[newOne].text;
				}
				break;
			default:
				break;
		}
	}
}
function multiSelects(el) { //extend Multiple Selects
	el.oldClassName = el.className;
	el.height = el.offsetHeight;
	el.width = el.offsetWidth;
	el.topLeft = document.createElement('img');
	el.topLeft.src = imagesPath + "0.png";
	el.topLeft.className = "NFMultiSelectTopLeft";
	el.topRight = document.createElement('div');
	el.topRight.className = "NFMultiSelectTop";
	el.bottomLeft = document.createElement('img');
	el.bottomLeft.src = imagesPath + "0.png";
	el.bottomLeft.className = "NFMultiSelectBottomLeft";
	el.bottomRight = document.createElement('div');
	el.bottomRight.className = "NFMultiSelectBottom";
	el.left = document.createElement('div');
	el.left.className = "NFMultiSelectLeft";
	el.right = document.createElement('div');
	el.right.className = "NFMultiSelectRight";
	el.init = function() {
		var top = this.parentNode;
		if(this.previousSibling) {var where = this.previousSibling;}
		else {var where = top.childNodes[0];}
		top.insertBefore(el.topRight, where);
		top.insertBefore(el.right, where);
		top.insertBefore(el.bottomRight, where);
		this.topRight.appendChild(this.topLeft);
		this.right.appendChild(this.left);
		this.right.appendChild(this);
		this.bottomRight.appendChild(this.bottomLeft);
		el.style.width = el.topRight.style.width = el.bottomRight.style.width = el.width + 'px';
		el.style.height = el.left.style.height = el.right.style.height = el.height + 'px';
		el.className = "NFMultiSelect";
	}
	el.unload = function() {
		this.parentNode.parentNode.appendChild(this);
		this.parentNode.removeChild(this.topRight);
		this.parentNode.removeChild(this.bottomRight);
		this.parentNode.removeChild(this.right);
		this.className = this.oldClassName;
		this.style.width = this.style.height = "";
	}
	el.onfocus = function() {
		this.topLeft.className = "NFMultiSelectTopLeft NFh";
		this.topRight.className = "NFMultiSelectTop NFhr";
		this.left.className = "NFMultiSelectLeftH";
		this.right.className = "NFMultiSelectRightH";
		this.bottomLeft.className = "NFMultiSelectBottomLeft NFh";
		this.bottomRight.className = "NFMultiSelectBottom NFhr";
	}
	el.onblur = function() {
		this.topLeft.className = "NFMultiSelectTopLeft";
		this.topRight.className = "NFMultiSelectTop";
		this.left.className = "NFMultiSelectLeft";
		this.right.className = "NFMultiSelectRight";
		this.bottomLeft.className = "NFMultiSelectBottomLeft";
		this.bottomRight.className = "NFMultiSelectBottom";
	}
}
function option(el, no) { //extend Options
	el.li = document.createElement('li');
	el.lnk = document.createElement('a');
	el.lnk.href = "javascript:;";
	el.lnk.ref = el.parentNode;
	el.lnk.pos = no;
	

	

	el.lnk._onclick = el.onclick || function () {
		
		el.lnk.ref.value = el.value;
		//fireEvent(el.parentNode,'change');
		
		if (el.lnk.ref.onchange) 
			el.lnk.ref.onchange();

		
	};

	el.txt = document.createTextNode(el.text);
	el.lnk.appendChild(el.txt);
	el.li.appendChild(el.lnk);
}

/*
function fireEvent(element,event){
    if (document.createEventObject){
        var evt = document.createEventObject();
        return element.fireEvent('on'+event,evt)
    }
    else{
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent(event, true, true ); 
        return !element.dispatchEvent(evt);
    }
}
*/

function formsubmit(obj) {
		return obj.form.submit();
}

//Get Position
function findPosY(obj) {
	var posTop = 0;
	do {posTop += obj.offsetTop;} while (obj = obj.offsetParent);
	return posTop;
}
function findPosX(obj) {
	var posLeft = 0;
	do {posLeft += obj.offsetLeft;} while (obj = obj.offsetParent);
	return posLeft;
}
//Get Siblings
function getInputsByName(name) {
	var inputs = document.getElementsByTagName("input");
	var w = 0; var results = new Array();
	for(var q = 0; q < inputs.length; q++) {if(inputs[q].name == name) {results[w] = inputs[q]; ++w;}}
	return results;
}

//Add events
var existingLoadEvent = window.onload || function () {};
var existingResizeEvent = window.onresize || function() {};

//window.onload = function () {
 //   existingLoadEvent();
//    NFInit();
//}

// window.addEvent('domready', function(){NFInit()});
window.onresize = function() {
	if(resizeTest != document.documentElement.clientHeight) {
		existingResizeEvent();
		NFFix();
	}
	resizeTest = document.documentElement.clientHeight;
} 



//

			

