
	var BRWREQ;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		BRWREQ = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		BRWREQ = new XMLHttpRequest();			
	}//END BrowserObject
	if (BRWREQ == null) {
	        alert("Your browser does not support AJAX");
    	}//
	var CMD;
		
        function ProcessField(inputId) {          
           elementType = document.getElementById(inputId).type;
           
           if(elementType == "select-one") {
             itemSelected = document.getElementById(inputId).selectedIndex;
             return document.getElementById(inputId).options[itemSelected].value;
           }
           
                    
           if(elementType == "text" || elementType == "hidden" || elementType == "password") {
	     return document.getElementById(inputId).value;           
           }

           if(elementType == "radio") {           
           	radioObj = document.getElementsByName(inputId);
           	var checkedValue="";
           	for(var i=0;i< radioObj.length;i++) {
           		if(radioObj[i].checked) 
           			checkedValue = radioObj[i].value;
           		  
           	}           	
	     	return checkedValue;          
           }           
        }
        
        
        var RESPCMD="";
        var processCallBack;
        
        
        function ProcessBackRequest(requestPage,REQCMD) {        	        	
        	//Create KeyValue Pairs        	
        	THEREQUEST = "CMD="+REQCMD;        	                	        	
	      	BRWREQ.open("POST",requestPage,true);	      		      		      	
	      	BRWREQ.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	      		      		      		      		      	
	      	BRWREQ.onreadystatechange = ProcessBackResponse;
	      	BRWREQ.send(THEREQUEST);
        }        
      
        
	function ProcessBackResponse() {     				
	  if(BRWREQ.readyState == 4) {   	 		 		
	    if(BRWREQ.responseText == "NOVALUES") {
		alert(CMD + " Failed");
	    }//END IF FOR NO VALUES
	    else {	    	
		RESPCMD = urlDecode(BRWREQ.responseText);		
		RESPCMD = trim(RESPCMD);
		processCallBack.invoke();		
	    }//END ELSE FOR VALUES
	  } 
	}//END ProcessBackResponse      
	
	function ProcessResponse(OUTPUT) {
	   RESPTYPE = RESPCMD.substring(0,RESPCMD.indexOf('@@@'));
	   RESPVALUE = RESPCMD.substring(RESPCMD.indexOf('@@@')+3);
	   
	   totalFields = OUTPUT[0];
	   processMethod = OUTPUT[totalFields+1];
	   
	   
	   if(RESPTYPE =='DELIM' && processMethod == "SPLITNASSIGN") {
	   	if(totalFields ==1) {
	   	   outputField = document.getElementById(OUTPUT[1]);
	   	   fieldType = document.getElementById(OUTPUT[1]).type;
		   //outputField Type is SINGLE SELECT           
           	   if(fieldType == "select-one") {
           	     selectValues = RESPVALUE.split('**');
           	     PopulateSelect(outputField,selectValues);
           	   }
           	   
	   	}//END IF FOR totalfields == 1
	   }//END IF FOR RESPONSE TYPE DEMIL AND processMethod SPLITNASSIGN
	   
	   
	   
	}//END FUNCTION ProcessResponse
        
        

	
	function PopulateSelect(outputField,selectValues) {	
		outputField.options.length = 0;					
		outputField.options[0] = new Option("Select","0",false);
		for(var i=0;i<selectValues.length-1;i++) {
		   eachOptions = selectValues[i].split("||");
		   outputField.options[i+1] = new Option(eachOptions[1],eachOptions[0], false);		   
		}
	}//END PopulateSelect
	
	
	
	function CalcKeyCode(aChar) {
	  var character = aChar.substring(0,1);
	  var code = aChar.charCodeAt(0);
	  return code;
	}//END CalcKeyCode
	
	function checkNumber(fieldId) {
	  val = document.getElementById(fieldId);	  	  
	  var strPass = val.value;	  
	  var strLength = strPass.length;
	  var lchar = val.value.charAt((strLength) - 1);
	  var cCode = CalcKeyCode(lchar);	
	  if (cCode < 48 || cCode > 57 ) {
	    var myNumber = val.value.substring(0, (strLength) - 1);
	    val.value = myNumber;
	  }
	  return false;
	}//END CheckNumber
	
	function clearField(fieldId) {
	  document.getElementById(fieldId).value = "";	
	}
	

	function checkChecked(checkField) {
	    radioObj = document.getElementsByName(checkField);
	    var checkedValue="NOCHECKED";
	    for(var i=0;i< radioObj.length;i++) {
	        if(radioObj[i].checked) 
	            checkedValue = radioObj[i].value;
	
   	     } 
   	     if(checkedValue !="NOCHECKED")
   	     return true;
   	     else 
   	     return false;
   	  
	}//END checkChecked function
	
	
	function ShowDetails(details) {						
		document.getElementById("details").innerHTML = decodeHex(details);		
		document.getElementById("showDetails").style.visibility="visible";
		scrollValues = ScrollPosition();
		ScrollLeft = scrollValues.substring(0,scrollValues.indexOf(":"));
		ScrollTop = scrollValues.substring(scrollValues.indexOf(":")+1,scrollValues.length);						
		document.getElementById("showDetails").style.left = ScrollLeft +"px";
		document.getElementById("showDetails").style.top = ScrollTop +"px";		
		opacity("showDetails",0,100,500);		
		
	}//END ShowDetails function	

	function HideDetails() {		
		field = document.getElementById("showDetails").style;
		field.opacity=0;
	    	field.MozOpacity = 0;
	    	field.KhtmlOpacity = 0;
	    	field.filter = "alpha(opacity=0)";		
		field.visibility="hidden";
	}//END ShowDetails function
	
	function opacity(id, opacStart, opacEnd, millisec) {
	    //speed for each frame
	    var speed = Math.round(millisec / 100);
	    var timer = 0;

	    //determine the direction for the blending, if start and end are the same nothing happens
	    if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
		    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
		    timer++;
		}
	    } else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
		    {
		    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
		    timer++;
		}		
	    }
	}//END opactiy Function

	//change the opacity for different browsers
	function changeOpac(opacity, id) {	  		
	    var field = document.getElementById(id).style;
	    field.opacity = (opacity / 100);
	    field.MozOpacity = (opacity / 100);
	    field.KhtmlOpacity = (opacity / 100);
	    field.filter = "alpha(opacity=" + opacity + ")";
	}//END ChangeOpac Function


	function trim (str) {
		var	str = str.replace(/^\s\s*/, ''),
			ws = /\s/,
			i = str.length;
		while (ws.test(str.charAt(--i)));
		return str.slice(0, i + 1);
	}
	
	function ScrollPosition() {
		var ScrollLeft = document.body.scrollLeft;		
		if (ScrollLeft == 0) {		
		    if (window.pageXOffset)		
			ScrollLeft = window.pageXOffset;		
		    else		
			ScrollLeft = (document.body.parentElement) ? document.body.parentElement.scrollLeft : 0;		
		}	
		var ScrollTop = document.body.scrollTop;		
		if (ScrollTop == 0) {		
		    if (window.pageYOffset)		
			ScrollTop = window.pageYOffset;		
		    else		
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;		
		}
		
		return ScrollLeft+":"+ScrollTop;

	}//END Function ScrollPosition

//START SLIDE SHOW	

function SlideFields(sfieldsArray,container) {
	var obj = new Slide();
	obj.sfieldsArray = sfieldsArray
	obj.container = document.getElementById(container);		
	obj.eachIndex=0;
	obj.eachStart=true;	
	obj.snfield;
	obj.smouse = false;		
	obj.invoke();
}//END SlodeFields Function 

function Slide() {
	this.invoke = function() {
		var thisObj = this;
		
		if(this.eachIndex == this.sfieldsArray.length) {
			this.eachIndex=0;
			for(i=0;i<this.sfieldsArray.length;i++){
				document.getElementById(this.sfieldsArray[i]).style.top = this.tempTopIndex+"px";
			}			
			//setTimeout(function(){thisObj.invoke();},3000);
		}//END IF to reset all fields top position
			 
														
		if(this.eachStart) {				   															
			if(this.snfield) this.snfield.style.display="none";					
			this.sfield = document.getElementById(this.sfieldsArray[this.eachIndex]);
			if(this.sfield.id){				
				this.snfield = this.sfield;
				this.topIndex = parseInt(this.snfield.style.top);	
				this.tempTopIndex = this.topIndex;						
				this.topMIndex = parseInt(this.snfield.style.height) - this.topIndex ;						 				
				this.snfield.style.display="block";
				this.eachStart = false;				

				this.container.onmouseover = function() {				
					thisObj.smouse = true;																	
				}//end cointainer mouseover 
				
				this.container.onmouseout = function(event) {	
					element = thisObj.snfield;
					var current_mouse_target = null;
					if(!event) 
						event = window.event;
					if(event.toElement) {				
						current_mouse_target = event.toElement;
					} else if( event.relatedTarget ) {				
						current_mouse_target = event.relatedTarget;
					}
					if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
						thisObj.smouse = false;
						//thisObj.topIndex = thisObj.topMIndex;
						//thisObj.snfield.style.top = thisObj.topIndex;
						//setTimeout(function(){thisObj.invoke();},3000/1000)	
					}
				}//end cointainer mouse out


			}//END IF for New Field	
		}//END IF for each fields slide
		
		if(this.snfield) {
			this.snfield.style.top = this.topIndex+"px";					
			if(this.topIndex >= this.topMIndex) {
				setTimeout(function(){thisObj.invoke();},300/1000)						
			}//END IF for field reaching Topindex
			else {								
				this.eachStart=true;				
				this.eachIndex++;				
				if(this.eachIndex < this.sfieldsArray.length) {								
					setTimeout(function(){thisObj.invoke();},3000)					
				}else {														 
					setTimeout(function(){thisObj.invoke();},3000)
				}				
			}//END ELSE for incrementing new fields counter
			if(!this.smouse)
			this.topIndex--;
		}	
	}//END invokde Function		
			
}//END Sliude Function

//END SLIDE SHOW

function is_child_of(parent, child) {
	if( child != null ) {			
		while( child.parentNode ) {
			if( (child = child.parentNode) == parent ) {
				return true;
			}
		}
	}
return false;
}//END is_child Fcuntion

function SearchResult(search) {
	var url="http://" + document.domain + "/search/search.php?q=" + search + "&offset=0";
	window.open (url,'_self');
}

function login(){
	document.getElementById('sd').innerHTML="<font style='color:red;font-size:9px;'>Login Not Valid</font>";
}