
function res_populateCourseDoNotHideSpec(formCourseId, formSpecId)
		{
        var courseEle = document.getElementById(formCourseId);
        var specEle = document.getElementById(formSpecId);

        var selI = courseEle.selectedIndex;

        // Remove existing elements from spec
        specEle.length = 0;

        if (courseEle.value == "SELECT")
        {
                var optSelect = new Option();
                optSelect.text = "SELECT";
                optSelect.value = "SELECT";

                specEle[0] = optSelect;
        }
        else if(courseEle.value == "Others")
        {
				var optSelect = new Option();
                optSelect.text="SELECT";
                optSelect.value="SELECT";
                specEle[0]=optSelect;
				 var opt1=new Option();
				opt1.text="Others";
				opt1.value="Others";
				specEle[1]=opt1;
				specEle.selectedIndex=1;
        
        }
        else
        {
                var sp1 = courseEle[selI].value.split("|X|");
                
                
                var sp2 = sp1[1].split("#");
				
                var optSelect = new Option();
                optSelect.text = "SELECT";
                optSelect.value = "SELECT";
                specEle[0] = optSelect;
                for (var i = 1; i <= sp2.length; ++i)
                {
						var optVal=sp2[i-1].split("^");
                        var opt = new Option();
                        opt.text = optVal[1];
                        opt.value = optVal[0];

                        specEle[i] = opt;
                }
        }
		}
		
function getStyleObject(objectId) 
		{
			// cross-browser function to get an object's style object given its id
			if(document.getElementById && document.getElementById(objectId)) 
			{
				// W3C DOM
				return document.getElementById(objectId).style;
			} 
			else if (document.all && document.all(objectId)) 
			{
				// MSIE 4 DOM
				return document.all(objectId).style;
			} 
			else if (document.layers && document.layers[objectId]) 
			{
				// NN 4 DOM.. note: this won't find nested layers
				return document.layers[objectId];
			} 
			else 
			{
				return false;
			}
		} // getStyleObject
		function changeObjectVisibility(objectId, newVisibility) 
		{
		
			// get a reference to the cross-browser style object and make sure the object exists
			var styleObject = getStyleObject(objectId);
			if(styleObject) {
				styleObject.display= newVisibility;
				return true;
			} else {
				// we couldn't find the object, so we can't change its visibility
				return false;
			}
			
		} // changeObjectVisibility
		function showHideSecondTextBox(cityId, ocityId)
		{
        cityDD = document.getElementById(cityId);

        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value != 'Others') // selected element contains "other", so show "ocity open box"
               changeObjectVisibility(ocityId, 'none'); 
        else
                
                changeObjectVisibility(ocityId, '');
		}
		function showHideFirstSecondTextBox(cityId, ocityId,ocountry)
		{
        cityDD = document.getElementById(cityId);

        var selI = cityDD.selectedIndex;
        if (cityDD[selI].value != 'Others') // selected element contains "others", so show "ocity open box"
              {
               changeObjectVisibility(ocityId, 'none'); 
               changeObjectVisibility(ocountry, 'none'); 
               }
               
        else
                {
                changeObjectVisibility(ocityId, '');
                changeObjectVisibility(ocountry, ''); 
                }
		}
		
		function isEmailInvalid(email)
{		
		var atChar=0;
		var dotChar=0;
 		var theChar="";
		var preChar="";
		var adjFlag=false
		var lastChar=""	

		if(email.value.length==0)
		return true;
		for(var i=0;i<email.value.length; i++)
		{
		 theChar= email.value.substring(i,i+1);
			if (i==0)
			{
		  				if (theChar==" ")
		  				{
		  					return false;
		  				}
			}
			if((theChar =="@"))
				{
				atChar++;							
				}	
			if((theChar =="."))
				{
					dotChar++;							
					if(preChar==theChar || preChar=="@")
					adjFlag=true;										
				}			

			preChar=theChar;
			lastChar=theChar	

		}	

		if( (atChar<=0 ||atChar>1) ||(dotChar<=0) ||(lastChar==".") ||(adjFlag==true))	

		{
				
			return false;
		}
			
}
		function isNum(argvalue) 
		{
			argvalue = argvalue.toString();
			if (argvalue.length == 0)
			return true;

			for (var n = 0; n < argvalue.length; n++)
			if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
			return false;
			return true;
		}
		

function checkQuote(field)
{

	for(var i=0;i<field.value.length;i++)
	{
		var theChar=field.value.substring(i,i+1);
		if(theChar=="'")
		{
				return false;
		}
		if(theChar=="@")
		{
				return false;
		}
		
	}
}
function isValidPhone(argvalue)
		{

			argvalue = argvalue.toString();
			if (argvalue.length == 0)
			return true;
			var bool=false

			for (var n = 0; n < argvalue.length; n++)
			{
			
				if ((argvalue.charCodeAt(n) > 47 &&  argvalue.charCodeAt(n) < 58) || argvalue.substring(n, n+1) =="," || argvalue.substring(n, n+1) =="-" || argvalue.substring(n, n+1) =="/" )
				{
				bool=true;
				}
				else
				{				
				bool=false;
				break;
				}
				
			}
			if(bool==false)
			{
			return false;
			
			}
			else
			{
			return true;
			}
		}
		
		function checkSpace(field)
		{
		for(var i=0;i<field.value.length;i++)
			{
			var theChar=field.value.substring(i,i+1);
				if(theChar==" ")
				{
						return false;
				}
				
			}
		}
		function checkSpecial(field)
		{
			for(var i=0;i<field.value.length;i++)
			{
			var theChar=field.value.substring(i,i+1);
				if(theChar=='~' || theChar=='!' || theChar=='@' || theChar=='#' || theChar=='%' || theChar=='^' || theChar=='&' || theChar=='*' || theChar=='?' || theChar=='1' || theChar=='2' || theChar=='3' || theChar=='4' || theChar=='5' || theChar=='6' || theChar=='7' || theChar=='8' || theChar=='9' || theChar=='0' || theChar=='$' || theChar=='{' || theChar=='}' || theChar=='[' || theChar==']'
				|| theChar==';' || theChar==':' || theChar=='"' || theChar=='<' || theChar=='>' || theChar=='/' || theChar=='(' || theChar==')' || theChar=='+' || theChar==',' || theChar=='=' || theChar=='|')
				{
				return false;
				}
			}
		}
		
		function validatecombo(ddl,txt)
		{
			if(ddl.selectedIndex==ddl.length-1)
			{
				if(txt.value=='Others')
				{
				
				return false;
				}
			
			}
		
		
		}
		function res_ListBox(formCourseId, formSpecId)
		{
        var courseEle = document.getElementById(formCourseId);
        var specEle = document.getElementById(formSpecId);

        var selI = courseEle.selectedIndex;

        // Remove existing elements from spec
        specEle.length = 0;
		if(selI>=0)
		{
        if (courseEle.value == "Any")
        {
        
                var optSelect = new Option();
                optSelect.text = "Any";
                optSelect.value = "Any";
		
                specEle[0] = optSelect;
          
        }
         /*
        else if(courseEle.value == "Any")
        {
				
				var optSelect = new Option();
                optSelect.text="SELECT";
                optSelect.value="SELECT";
               
                specEle[0]=optSelect;
                
				 var opt1=new Option();
				opt1.text="Others";
				opt1.value="Others";
				specEle[1]=opt1;
				specEle.selectedIndex=1;
				
        
        }
         */
        else
        {
                var sp1 = courseEle[selI].value.split("|X|");
                
                
                var sp2 = sp1[1].split("#");
			
                var optSelect = new Option();
                optSelect.text = "Any";
                optSelect.value = "Any";
             
                specEle[0] = optSelect;
               
                for (var i = 1; i <= sp2.length; ++i)
                {
						var optVal=sp2[i-1].split("^");
                        var opt = new Option();
                        opt.text = optVal[1];
                        opt.value = optVal[0];

                        specEle[i] = opt;
                }
        }
        }
        
		}
		
		function res_ComboText(dlist,tbox)
		{
			var ddl = document.getElementById(dlist);
			var txt = document.getElementById(tbox);
			 var selI = ddl.selectedIndex;

        // Remove existing elements from spec
			txt.value='';

        if (ddl.value == "SELECT")
        {
                txt.value='';
        }
        else
        {
			txt.value=ddl[selI].value;
        }
			
		}

		