	var callback =   
    {   
        success: populateCombo,   
        failure: showFailure        
    }

	var callback_onlineApp =   
    {   
        success: populateCombo_spec,   
        failure: showFailure        
    }

    var callback1 =   
    {   
        success: populateText,   
        failure: showFailure        
    }

    function populateText(o)
   	{
  	  //	document.getElementById("wlw-select_key:{actionForm.specialty}").value =  o.responseText; // commenting for migrationMEDSTAFFMIG6  	
  	  	document.getElementById("specialty0").value =  o.responseText;   
  	  	   
   	}   
   	 
    function populateCombo_spec(o)
    {
       	var selSpec = "";   
		// if Internal server error
		if(o.status >= 500)
	    {
	        showFailure(o);
	        return;
	    }
		//Get handle to dropdown component
	   // var select = document.getElementById("wlw-select_key:{actionForm.specialty}"); // commenting for migrationMEDSTAFFMIG6
    	  var select = document.getElementById("specialty0");
    	//store default specilty to temp variable
    	if(select != null)
    	{
	    	selSpec = select.value;
	    }
	    	    
	    //Empty the dropdown list 
        select.options.length = 0;
        
        // Create default option  
        if(select!= null && !select.multiple)		
		{		
			select.options[0]=  new Option("Choose Specialty",'netui_null');
		}
		
		//Reposonse JSON text
	  	var jsonText = o.responseText;
	  	
	  	
	  	// Covert text to actual Javascipt Object
	  	var specs = eval( "(" + jsonText + ")" );	  	
		var key 	= null;
		var value 	= null;
		var itemCount = 0;	
    	 		
	  	/*  	
		var arr =jsonText.split(","); 
		var i=0,j=0;	
			*/
		
    	if(select != null)
    	{
			for (key in specs) 
			{
				value= specs[key];			
				select.options[itemCount+1]=  new Option(value,key);			
				if(key == selSpec)
				{
					select.options[itemCount+1].selected = true
				}

				itemCount++;
			}			
	    }
		/*
		for( i = 0 ; i < arr.length ; i++)
		{
			var item = arr[i].split(":");
		
			if(!select.multiple)
			{
				if(item[1] != undefined && item[1] != 'undefined')
				{
					select.options[i+1]=  new Option(item[1],item[0]);
					//if(item[0] == selSpec) //Payal : added below condition,coz item[0] coming with some extra information
					if(item[0].indexOf(selSpec)!= -1)
					{
						select.options[i+1].selected = true;					
					}
				}
			}
			else
			{
				if(item[1]!=undefined && item[1] != 'undefined')
				{
					select.options[i]=  new Option(item[1],item[0]);
				}			
			}
		}*/
    }

    function populateCombo(o)
    {
		if(o.status >= 500)
	    {
	        showFailure(o);
	        return;
	    }
	    var select = document.getElementById("spec");
        select.options.length = 0;
	  	var jsonText = o.responseText;
		var arr =jsonText.split(","); 
		var i=0,j=0;
		
		if(!select.multiple)
		{
			select.options[0]=  new Option("SELECT SPECIALTY",'netui_null');
		}
		
		for( i = 0 ; i < arr.length ; i++)
		{
			var item = arr[i].split(":");
			if(!select.multiple)
			{
				if(item[1] != undefined && item[1] != 'undefined')
				{
					select.options[i+1]=  new Option(item[1],item[0]);
				}
			}
			else
			{
				if(item[1]!=undefined && item[1] != 'undefined')
				{
					select.options[i]=  new Option(item[1],item[0]);
				}			
			}
		}
    }
    
	function populateDropdownWithJSON(jsonText,objectId,targetElementId,defaultKey,defaultValue)
    {
       	var jsonObj = eval(jsonText);
		var specs 	= jsonObj[objectId];
		var spec 	= null;
		var key 	= null;
		var value 	= null;
		var itemCount = 0;	

	    var select = document.getElementById(targetElementId);
    	 		
    	if(select != null)
    	{
	    	selSpec = select.value;
            select.options.length = 0;

			if(defaultValue != null)
			{
				select.options[itemCount++]=  new Option(defaultValue,defaultKey); 
			}

			//select.options[i+1].selected = true;
			for (key in specs) 
			{
				value= specs[key];			
				select.options[itemCount++]=  new Option(value,key);			
			}			
	    }
    }

	function showFailure(o){}	
		
	function toCityJobSearch(cntxRt,section,city)
	{	 	
		window.opener.location =cntxRt+"/dynamicui/toJobSearch.do?section="+section+"&src=promo&city="+city;
		window.close();	
	}
	
	// Removes leading whitespaces
	function LTrim( value ) 
	{
		var re = /\s*((\S+\s*)*)/;
		return value.replace(re, "");	
	}
	
	// Removes ending whitespaces
	function RTrim( value ) 
	{
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "");		
	}
	
	// Removes leading and ending whitespaces
	function trim( value ) 
	{
	      return LTrim(RTrim(value));
	}
	 /************************* Library Functions **************************/
    /* This function checks email validation */
    function isEmail(email) 
    {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
        {
            return (true);
        }
        return (false);
    }
    
    /*This function checks undefined anfd null objects */
    function isDigit(str)
    {
       regExInvalidChars = /[^a-zA-Z]+/;
       if (regExInvalidChars.test(str))
       { 
             return false;
       }
       else
       {
             return true;
       }
    }
    
    function isSpace(str)
    {
       regExInvalidChars = /[^a-zA-Z,\s]+/;
       if(regExInvalidChars.test(str))
       { 
         return false;
       }
       else if(str.split(' ').length>0)
       {
          return true;
       }
       return false;
    }
   
    function isPhoneNumber(phoneNo)
    {
       regExInvalidChars = /[^0-9]/;
       
       if (regExInvalidChars.test(phoneNo))
       { 
             return false;
       }
       else
       {
        if(phoneNo.length < 11)
        {
             return false;
        }
      }  
       return true;
    }
    
    /*This function checks undefined anfd null objects */    
    function validateObject(str)
    {
    	if
    	(
    		str != null && str != 'null' && 
    		str!=undefined && 
    		str!='undefined' &&  str.trim()
    	)
       	{
        	return true;
        }
        else
        {
          	return false;
        }
    }
	
	String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
	};
	
	/*
	* Function to show and hide the div layers.
	* @ param	: It takes two parameters as a id's of div layers 
	*			  first, which to make visible and second, to
	*			  make invisible.
	* @ call	: showhide('id1','id2);	
	* */	
	function showhide(show,hide) 
	{ 
		if (document.getElementById)
		{ 
			obj1 = document.getElementById(show); 
			obj2 = document.getElementById(hide); 
			if(obj1 != null) 
			{
				obj1.style.display = "block";  			
			}
	
			if(obj2 != null)
			{
					obj2.style.display = "none";                                
			}
		} 
	}

	function hide(outerDiv,detDiv)
	{
		obj1 = document.getElementById(detDiv); 
		obj2 = document.getElementById(outerDiv); 
		if(obj1 != null && obj2 != null && obj2.className != "off")
		{			
			alterClass(outerDiv);
			showhide(null,detDiv)
		}
	}

	function show(outerDiv,detDiv)
	{
		if(outerDiv != 'q0')
		{
			//hideQ0();
		}

		obj1 = document.getElementById(detDiv); 
		obj2 = document.getElementById(outerDiv); 
        
		           /* Commented for legal back prblm of changin bg image of questns alterClass(outerDiv);*/
          
          if(outerDiv=='q2')
          {alterClassQ2(outerDiv);
          }
          else if(outerDiv =='q1')
          {
          alterClass(outerDiv);
          }
          else 
          {
          alterClassQ3_5(outerDiv);
          }

		if(obj1 != null && obj2 != null && obj2.className != "off")
		{
			showhide(detDiv,null);
		}
		else
		{
			
			showhide(null,detDiv);		
		}
	}

	function alterClass(id)
	{
		obj1 = document.getElementById(id); 
	
		if(obj1 != null ) 
		{
			if(obj1.className == "on1" ) 
			{
				obj1.className="off"; 
			}
			else
			{
				obj1.className="on1"; 
			}
		}
	}

	function expand(outerDiv,detDiv)
	{
		obj1 = document.getElementById(detDiv); 
		obj2 = document.getElementById(outerDiv); 		
		document.getElementById(outerDiv).className = "on1";
		showhide(detDiv,null);
	}

	
	function populateRecDropdownWithJSON(jsonText,targetElementId,defaultKey,defaultValue)
    {
       	var jsonObj = eval(jsonText);
		var key 	= null;
		var value 	= null;
		var itemCount = 0;	

	    var select = document.getElementById(targetElementId);
    	 		
    	if(select != null)
    	{
            select.options.length = 0;

			select.options[itemCount++]=  new Option(defaultValue,defaultKey); 

			if(select.value == defaultKey)
			{
				select.options[itemCount-1].selected = true;
			}
			
			for (key in jsonObj) 
			{
				value = jsonObj[key];			
				select.options[itemCount++]=  new Option(key,value);			

				if(select.value == value)
				{
					select.options[itemCount-1].selected = true;
				}
			}			
	    }
    }
	

	function convertToInt(el)
	{
		 if(el != null && el.value != "")
		 {
		 	el.value  = parseInt(el.value,10);
		 }
	}

	