﻿// JScript File

   var IsValidFile = false;
	var httpRequester ;
	var couldProcess = false;
   
	function Checkfiles(oSrc, args) {
	  var fname = args.Value;
	  if (fname.length>0) {
	  }
	  if (fname.length==0)
	  { 
		IsValidFile=true;
		args.IsValid = (fname.length==0);
		}
	  else {
	  
		var fext = fname.substring(fname.length-3).toLowerCase();
		args.IsValid = (fext=='jpg' || fext=='gif' || fext=='jpe') ;
		IsValidFile = args.IsValid;
	  }
	}
   
	function ValidateCheckbox(source, arguments)
	{ arguments.IsValid = Form1.chkPersistLogin.checked; }

	function RequestInitializer()
			{
				
				//httpRequester = new ActiveXObject("Microsoft.XMLHTTP");
				if (typeof XMLHttpRequest != 'undefined'){
					httpRequester = new XMLHttpRequest();
				} else if (window.ActiveXObject){
				try{
				httpRequester = new ActiveXObject('Msxml2.XMLHTTP');
			} catch(e) {
					try{
						httpRequester = new ActiveXObject('Microsoft.XMLHTTP');
					} catch(e) {}
			}
				}
			}
function fillCountryCbo(cid){
			var serverSideURL = "Ajx_country.aspx?region=";	
			//alert(document.getElementById("cboregion").value);
			var messageID=document.getElementById("cboregion").value;
			serverSideURL =serverSideURL +   messageID;
			if(cid)
			{
				serverSideURL = serverSideURL +   "&country=" + cid;
			}
			stopDuplicate = 0
			RequestInitializer()
			//PC_findObj('OtherCountry').style.display = 'none';
			//PC_findObj('OtherCountry').value = "";
			if (!couldProcess && httpRequester) {
			  //      alert(serverSideURL)
				httpRequester.open("GET", serverSideURL, true);
				httpRequester.onreadystatechange = processResponse;
				couldProcess = true;
				httpRequester.send(null);
				
			}            
		}
		
		
		var idToDisplay = 1; //default value
		var COMPLETE = 4; //constant for the complete state of the http request
		var stopDuplicate = 0;
		function processResponse() {
		  if ( httpRequester.readyState == COMPLETE ) {
			if ( httpRequester.responseText.indexOf('invalid') == -1 ) {
			  document.getElementById('divcountry').innerHTML = httpRequester.responseText;
			  couldProcess = false;			   
			}
		  }
			
		}
		
		function ShowChannelList(a) 
		  {  
		 var x = document.getElementById("cbocountry").selectedIndex;
		 if(a=="")
		 {
		 document.getElementById("OtherCountry").style.display ='';
		 }
		 else{
		  document.getElementById("OtherCountry").style.display='none';
		  }
		  
		  var id_country=document.getElementById("ForCountryID");	      
		  id_country.value =a;	      
		 }
		 
		
  function showcourse()
  {
  
		var country_1=document.getElementById("cbocountry");
		
		
		if (!country_1)
			   {
				alert('Select Region');
				return false;  
		}
	
	 if(country_1.value == "0")
	  {    
	  alert('plese select Country');
	  document.getElementById("cboregion").focus();
	  return false; 
	  }
	  
	  var enter_country=document.getElementById("OtherCountry");
	  
	  if(country_1.value == "" && enter_country.value=="")
	   {
		 alert('plese enter CountryName');
		return false;
	  }
	  
	  document.getElementById('ForCountryID').value=country_1.value    
	  
	  var enter_email=document.getElementById('txtEmail');
	  if(enter_email.value=="")
	  {
	  alert("txtEmail is required");
	  return false;
	  }
	 
	}
	
	
	function ValidateCheckbox(source, arguments)
    { arguments.IsValid = add.chkPersistLogin.checked; }