//**************************************************************
//Name:        fncFocusedInput()
//Description: Draw a bordered SPAN around a focused element.
//Arguments:   oInput,IsFocused
//Return:      Nothing
//**************************************************************
function fncFocusedInput(oInput,IsFocused){    
	if(IsFocused){	    
		oInput.style.backgroundColor="#FCF7AA";
	}
	else{	
		oInput.style.backgroundColor="";
	}
}
//**************************************************************
//Name:        fncAddSelectOption()
//Description: Add Select Option.
//Arguments:   SelectID, SelectValue, SelectText, IsSelected, 
//			   IsMark, IsFirst
//Return:      Nothing
//**************************************************************
function fncAddSelectOption(SelectID, SelectValue, SelectText, IsSelected, IsMark, IsFirst)
{
	if(IsFirst){
		document.getElementById(SelectID).options.length=0;
	}
	var oOption=new Option(SelectText,SelectValue);
	if (IsSelected){
		oOption.selected=true;
	}
	else{
		oOption.selected=false;
	}
	if(IsMark){
		oOption.className="SelectOptionFormat";
	}
	document.getElementById(SelectID).options[document.getElementById(SelectID).length]=oOption;
}
//**************************************************************
//Name:        fncActionIFrame()
//Description: Create a Dinamic iFrame and Submit The data.
//Arguments:   FormName
//Return:      Bool
//**************************************************************
var IFrameObj; // our IFrame object
function fncActionIFrame(FormName){	    
	if(!document.createElement){return true};
	if(!IFrameObj && document.createElement){   
		// create the IFrame and assign a reference to the
		// object to our global variable IFrameObj.
		// this will only happen the first time 
		// function is called		
		try{
			if(document.all){
				var tempIFrame=document.createElement("<iframe name='HiddenFrame' id='HiddenName'></iframe>");
			}
			else{
				var tempIFrame=document.createElement('iframe');
			}
			tempIFrame.setAttribute('id','HiddenFrame');
			tempIFrame.setAttribute('name','HiddenFrame');
			tempIFrame.src='../blank.htm';	
			tempIFrame.style.border='0px';
			tempIFrame.style.width='0px';
			tempIFrame.style.height='0px';
			IFrameObj = document.body.appendChild(tempIFrame);
			
			// this is for IE5 Mac, because it will only
			// allow access to the document object
			// of the IFrame if we access it through
			// the document.frames array
			if(document.frames){
				IFrameObj = document.frames['HiddenFrame'];
			}
		} 
		catch(exception){
			// This is for IE5 PC, which does not allow dynamic creation
			// and manipulation of an iframe object. Instead, we'll fake
			// it up by creating our own objects.
			iframeHTML='\<iframe id="HiddenFrame" name="HiddenFrame" style="';
			iframeHTML+='border:0px;';
			iframeHTML+='width:0px;';
			iframeHTML+='height:0px;';
			iframeHTML+='"><\/iframe>';
			document.body.innerHTML+=iframeHTML;
			IFrameObj = new Object();
			IFrameObj.document = new Object();
			IFrameObj.document.location = new Object();
			IFrameObj.document.location.iframe = document.getElementById('HiddenFrame');
			IFrameObj.document.location.replace = function(location){
				this.iframe.src = location;
			}
		}
	}
	
	if((navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument )|| (navigator.userAgent.indexOf('Safari')!=-1 && !IFrameObj.contentDocument )){	    
		// we have to give NS6 a fraction of a second
		// to recognize the new IFrame				
		setTimeout('fncActionIFrame("'+FormName+'")',50);
		return false;
	}

	if (IFrameObj.contentDocument) {
		// For NS6
		IFrameDoc = IFrameObj.contentDocument; 		
	} else if (IFrameObj.contentWindow) {
		// For IE5.5 and IE6
		IFrameDoc = IFrameObj.contentWindow.document;		
	} else if (IFrameObj.document) {
		// For IE5
		IFrameDoc = IFrameObj.document;		
	} else {
		return true;
	}
	
	//IFrameDoc.location.replace(URL+fncBuildQueryString(FormName));
	IFrameDoc.location.replace("../blank.htm");
	document.getElementById(FormName).submit();
	return false;
}


//**************************************************************
//Name:        fncBuildQueryString()
//Description: Build query string out of a form.
//Arguments:   FormName
//Return:      Query String
//**************************************************************
function fncBuildQueryString(FormName){
	var FormObj = document.forms[FormName];
	var qs = ''
	for (e=0;e<FormObj.elements.length;e++){
		if (FormObj.elements[e].name!=''){
			qs+=(qs=='')?'?':'&'
			qs+=FormObj.elements[e].name+'='+escape(FormObj.elements[e].value)
		}
	}
	return qs;
}



