	/*----------------------------------------------------------------
	Description   :- function to validate the url
	Programmer    :- SDYA
	Last Modified :- 23/AUG/2008
	-------------------------------------------------------------------*/
	function ValidateURL(url) {
		var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
		if(RegExp.test(url)){
			return true;
		}else{
			return false;
		} 
	} 
	
	function show_site_address()
	{
		if(document.getElementById('chk_support').checked==true)
			document.getElementById('site_addr').style.display = "block";
		else
			document.getElementById('site_addr').style.display = "none";
	}

	function validate_address()
	{
		if(document.getElementById('chk_support').checked==true)
		{
			var newlink		= document.frm_contact.txt_site_address.value;
			var newlink1	= newlink.replace(/^\s+/,'').replace(/\s+$/,'');
			if(!ValidateURL(newlink1))
			{
				alert("You must supply a valid URL.");
				document.frm_contact.txt_site_address.focus();
				return false;
			}
		}
		return true;
	}
		
	/*----------------------------------------------------------------
	Description   :- function to popup the url
	Programmer    :- SDYA
	Last Modified :- 26/AUG/2008
	-------------------------------------------------------------------*/
	function popup(url)
	{
		var newwindow;
		if(url=="services-support.php")
			newwindow=window.open(url,'name','height=500,width=600,left=100,top=50,resizable=yes,scrollbars=yes,toolbar=no,status=no,directories=no');
		else
			newwindow=window.open(url,'name','height=300,width=400,left=400,top=350,resizable=yes,scrollbars=yes,toolbar=no,status=no,directories=no');
		if (window.focus) {newwindow.focus()}
	}
	
	/*----------------------------------------------------------------
	Description   :- function to display city when country is selected
	Programmer    :- JNO
	Last Modified :- 04/SEP/2008
	-------------------------------------------------------------------*/

	function show_city(elem,field)
	{	
	//alert("coutnry="+elem.value);
		if(elem.value == 1){
			
			document.getElementById(field).style.display = "block";}
		else
			document.getElementById(field).style.display = "none";
	}
	/*	function show_city()
		{	
			if(document.signup.affiliate_country.value == 1){
				document.getElementById('city').style.display = "block";}
			else
				document.getElementById('city').style.display = "none";
		}
	*/
	/*----------------------------------------------------------------
	Description   :- function to display error message tool tip and image.
	Programmer    :- JNO
	Last Modified :- 04/SEP/2008
	-------------------------------------------------------------------*/
	function tool_tip_js(field,imgid,boxid){
		
		
		var closeid=imgid+'_close';
		var trueid=imgid+'_true';
		
		if(field=='affiliate_fname' || field=='affiliate_lname' || field=='affiliate_address' || field=='affiliate_phone' || field=='affiliate_zip' || field=='affiliate_country' || field=='affiliate_city' || field=='affiliate_email' ||  field=='txt_newemail' || field=='affiliate_sitename' || field=='affiliate_siteurl' || field=='txt_code' || field=='password' || field=='new_password' || field=='con_pass'){
			var text =document.getElementById(field).value;
			text = text.replace(/ /g,"");
			//alert("text="+text);	
			if(text==''){
				
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';
				
			}else{
				
				document.getElementById(closeid).style.display = 'none';
				document.getElementById(trueid).style.display = 'block';
				document.getElementById(boxid).style.display = 'none';
				
			}
		
		}
		if(field=='affiliate_state' && document.getElementById('affiliate_country').value==1 ){
			var text =document.getElementById(field).value;
			text = text.replace(/ /g,"");
			if(text==''){
				
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';
				
			}else{
				document.getElementById(closeid).style.display = 'none';
				document.getElementById(trueid).style.display = 'block';
				document.getElementById(boxid).style.display = 'none';
				
			}
			
			
		}
		else if(field=='affiliate_state' && document.getElementById('affiliate_country').value!=1)
		{
			document.getElementById(closeid).style.display = 'none';
			document.getElementById(trueid).style.display = 'none';
			document.getElementById(boxid).style.display = 'none';

		}
		
		if(field=='affiliate_email' || field=='newemail'){
			//alert("in email");
			var mailid=document.getElementById(field).value;
			//alert("mailid="+mailid);
			mailid = mailid.replace(/ /g,"");
			if(mailid==''){
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';
			}else{
				var email_status=validate_email(mailid);	
				if(email_status){
					document.getElementById(trueid).style.display = 'block';
					document.getElementById(closeid).style.display = 'none';
					document.getElementById(boxid).style.display = 'none';
				}else{
					document.getElementById(closeid).style.display = 'block';
					document.getElementById(trueid).style.display = 'none';
					document.getElementById(boxid).style.display = 'block';
				}
			}
		}
		
		if(field=='affiliate_password' || field=='password' || field=='new_password' || field=='con_pass'){
			var pwd=document.getElementById(field).value;
			//alert("in password");
			pwd = pwd.replace(/ /g,"");
			var len=pwd.length;
			if(pwd=='' || len<6){  
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';	
			}else{
				document.getElementById(closeid).style.display = 'none';
				document.getElementById(trueid).style.display = 'block';
				document.getElementById(boxid).style.display = 'none';
				
			}
		}
		
		if(field=='img_verification'){
			var user_img=document.getElementById('img_verification').value;
			user_img=user_img.toLowerCase();
			var rand_img=document.getElementById('original').value;
			if(rand_img!=user_img){
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';		
			}else{
				document.getElementById(closeid).style.display = 'none';
				document.getElementById(trueid).style.display = 'block';
				document.getElementById(boxid).style.display = 'none';	
			}
		}
		<!--ValidateURL(getElementById('affiliate_siteurl'))-->
		if(field=='affiliate_siteurl'){
		
			var url = document.getElementById('affiliate_siteurl').value;
			
			var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
			if(RegExp.test(url)){
				document.getElementById(closeid).style.display = 'none';
				document.getElementById(trueid).style.display = 'block';
				document.getElementById(boxid).style.display = 'none';	
			}else{
				document.getElementById(closeid).style.display = 'block';
				document.getElementById(trueid).style.display = 'none';
				document.getElementById(boxid).style.display = 'block';	
			} 
		}
	
	}
	
	/*---------------------------------------------------------------
	Description   :- function to validate an email id
	Programmer    :- JNO
	Last Modified :- 04/SEP/2008
	-------------------------------------------------------------------*/ 
	  function validate_email(email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = email;
	   if(reg.test(address) == false) {
		  return false;
	   }
	   return true;
	}

    /*----------------------------------------------------------------
    Description   :- Function to Validate a number Field
    Programmer    :- JNO
	Last Modified :- 04/SEP/2008
    -------------------------------------------------------------------*/
	function ValidateNumber(e){
	
		var key;
		var keychar;
	
		if (window.event)
		key = window.event.keyCode;
		else if (e)
			key = e.which;
		else
			return true;
	
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
	
		if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
			return true;
		else if ((("0123456789.").indexOf(keychar) > -1))
			return true;
		else
			return false;
		
	}

    /*----------------------------------------------------------------
    Description   :- Function to Validate a number Field
    Programmer    :- JNO
	Last Modified :- 08/SEP/2008
    -------------------------------------------------------------------*/
	function passwordStrength(password)
	{
	
		var desc = new Array();
		desc[0] = "Very Weak";
		desc[1] = "Weak";
		desc[2] = "Better";
		desc[3] = "Medium";
		desc[4] = "Strong";
		desc[5] = "Strongest";
	
		var score   = 0;
		
		//if password bigger than 6 give 1 point
		if (password.length > 6) score++;
		//if password has both lower and uppercase characters give 1 point      
		
		if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
		
		//if password has at least one number give 1 point
		if (password.match(/\d+/)) score++;
		
		//if password has at least one special caracther give 1 point
		if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
		
		//if password bigger than 12 give another 1 point
		if (password.length > 12) score++;
		//document.getElementById("passwordDescription").innerHTML = desc[score];
		document.getElementById("passwordStrength").innerHTML = desc[score];
		document.getElementById("passwordStrength").className = "strength" + score;
	}
	
		/*----------------------------------------------------------------
		Description   :- Download report
		Programmer    :- AKL
		Last Modified :- 23/SEP/2008
		-------------------------------------------------------------------*/
		function DownloadStatusReport(page){
			
			var fromdate =document.getElementById('fromdate').value ; 
			var todate	=document.getElementById('todate').value ;
			//affiliate-stats~{$fromdate}~{$todate}_{$page}.html
			
			document.downloadStatus.action="affiliate-stats~"+fromdate+"~"+todate+"_"+page+".html";
			
			document.downloadStatus.submit();
		}
		
	/*----------------------------------------------------------------
	Description   :- function to show the pages
    Programmer    :- AKL
    Last Modified :- 24/SEP/2008
	-------------------------------------------------------------------*/
	function showpages(url1)
	{
		var perpage	= document.frm_paging.sel_page.value;
		var url	= url1+"_"+perpage+".html";
		document.frm_paging.action=url;
		document.frm_paging.submit(); 

	}

		/*----------------------------------------------------------------
		Description   :- Download report
		Programmer    :- AKL
		Last Modified :- 23/SEP/2008
		-------------------------------------------------------------------*/
		function InstallStatusReport(page){
			
			var fromdate =document.getElementById('fromdate').value ; 
			var todate	=document.getElementById('todate').value ;
			//affiliate-stats~{$fromdate}~{$todate}_{$page}.html
			
			document.installStatus.action="affiliate-install~"+fromdate+"~"+todate+"_"+page+".html";
			
			document.installStatus.submit();
		}

/*-------------------------------------------------------------------
Description   :- Show the rate window
Programmer    :- SBI
Last Modified :- 05/Jan/2008
-------------------------------------------------------------------*/
function Showsysmsgwindow(sysid){  
	if(sysid   ){ 
		var imageId= 'SystemMessage_'+sysid; 
		if(document.getElementById(imageId)=='null'){ 
			return false;
		}else{ 
			document.getElementById(imageId).style.display='none';
		}
		var url = "ajax_common.php?sysmsgId="+sysid;  //alert(imageId);  
		ajaxpage(url,imageId);
		
	}
}

/*----------------------------------------------------------------
Description   :- function to open a window 
Programmer    :- SBI
Last Modified :- 06/Jan/2008
-------------------------------------------------------------------*/
function OpenaNewWindow(){ 
	window.location='affiliate-dismiss.html';
}//end fucntion
	/*----------------------------------------------------------------
	Description   :- Function is used to show the payment info 
	Programmer    :- SBI
	Last Modified :- 20/Dec/2008
	-------------------------------------------------------------------*/
	function showPaymentInfo(){
		var Gateway = document.getElementById('Paymentgateway').value;
		if(Gateway==''){
			alert("Please select payment method");
		}else{
			var url= "ajax_common.php?action=Paymentinfo&gateway="+Gateway;
			ajaxpage(url,'Paymentdetails');
		}//end if
		
	}//end function
	
	
	/*----------------------------------------------------------------
	Description   :- list all records
	Programmer    :- MNU
	Last Modified :- 24/Nov/2008
	-------------------------------------------------------------------*/
	function listallrecords(url){  //alert("inner");
		value = document.getElementById('Sel_rec').value;
		url = "setrecordsperpage.php?&Sel_rec="+value+"&url="+url;
 		window.location=url;
	  }

