﻿// JScript File
function InitEmail(){

document.getElementById("ctl00_txtFriendEmail").value="";

}
function changeLang(lang)
{	

    if(location.href.indexOf("language") > 0)
	    {
		    var url =location.href;			
		    if(lang=="en")
		    {	
			    location.href=url.replace("language=ar","language=en")  ; 						
		    }
		    else
		    {
			    location.href=url.replace("language=en","language=ar")  ;
		    }		
	    }
	    else
	    {
		    if(location.href.indexOf('?') > 0)
		    {
			    location.href=(location.href +"&language=" +lang);
		    }
		    else
		    {
			    location.href=(location.href +"?language=" +lang);
		    }
	    }	
	}

function showMoreInfo(page,width,height) {
			var sUrl=page;
			
			iWinH = 360;
			iWinW = 718;

			iHeight = screen.height ;
			iWidth = screen.width;

			iLocX = iWidth - (iWidth/2 + iWinW/2)
			iLocY = iHeight - (iHeight/2 + iWinH/2)
				
			window.open (sUrl,"dl","width="+width+",height="+height+",toolbar=0,links=0,menus=0,scrollbars=0,top=" + iLocY +",left=" + iLocX);
		}
		
function displayConfirmation(message){
	
	if (confirm(message))
	{	
	return true;
	}
	else{
	return false;
	}
}

function showSubscriptions(c){
	iWinH = 360;
	iWinW = 718;
	
	iHeight = screen.height ;
	iWidth = screen.width;

	iLocX = iWidth - (iWidth/2 + iWinW/2)
	iLocY = iHeight - (iHeight/2 + iWinH/2)
window.open("http://localhost:3720/mubashercard.web/secure/ViewSubscriptions.aspx?c="+c,"win","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,top=100,left=300,width=377,height=325");
return false;
}
function showHelp(loc,height,width){
	iWinH = 360;
	iWinW = 718;

	iHeight = screen.height ;
	iWidth = screen.width;

	iLocX = iWidth - (iWidth/2 + iWinW/2)
	iLocY = iHeight - (iHeight/2 + iWinH/2)
window.open(loc,"win","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,top=100,left="+iLocY+",width="+width+",height="+height);

}

function popUpVerisign(url,width,height){
	iWinH = 360;
	iWinW = 718;

	iHeight = screen.height ;
	iWidth = screen.width;

	iLocX = iWidth - (iWidth/2 + iWinW/2)
	iLocY = iHeight - (iHeight/2 + iWinH/2)
window.open(url,"win","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=0,top=100,left="+iLocY+",width="+width+",height="+height);
}
function CheckUserName(source, arguments){
	arguments.IsValid=false;
	var uname=document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;
	
	
		if(checkName(uname))
		{
					arguments.IsValid=true;
		}
	}
		
function CheckInputLength(source, arguments)
	{
	
	  
		var usrName=document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;				
		var password=document.getElementById("ctl00_ContentPlaceHolder1_txtPassword").value;				
	    
		arguments.IsValid=false;
		
		if( (usrName !='') && (password !='') ){
			
			if( (usrName.length>= 5) && (usrName.length<= 12) && (password.length>= 5) && (password.length<=12) )
				arguments.IsValid=true;
			
		}
		
	}

function CheckInputLength2(source, arguments)
	{
	
	  
		var usrName=document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;				
						
	    
		arguments.IsValid=false;
		
		if( (usrName !='')  ){
			
			if( (usrName.length>= 5) && (usrName.length<= 12) )
				arguments.IsValid=true;
			
		}
		
	}

function checkName(username)
		{
		var name= username; 
		var tname=trimAll(name);
		
				
		if(name.length!=tname.length)
		{
		//alert(msg);
		return false;
		}
		
		for(var j=0; j<tname.length; j++)
		{
		var alphaa = tname.charAt(j);
		var hh = alphaa.charCodeAt(0);
		
			if((hh > 47 && hh <58) || (hh>64 && hh<91) || (hh>96 && hh<123))
			{
			}
			else
			{	//alert(msg);
				return false;
			}
		}
		return true;
			
		}
		
function checkNo(inumber)
		{
		var number= inumber; 
		var tnum=trimAll(number);
		
		if(tnum.length>14)
		{
		return false;
		}

		
					for(var j=0; j<tnum.length; j++)
					{
					var alphaa = tnum.charAt(j);
					var hh = alphaa.charCodeAt(0);
						if((hh > 47 && hh <58))
						{
						}
						else
						{	
							return false;
						}
					}
					return true;
			
		}
		function trimAll(sString) 
		{
		while (sString.substring(0,1) == ' ')
				{
				sString = sString.substring(1, sString.length);
				}
				while (sString.substring(sString.length-1, sString.length) == ' ')
				{
				sString = sString.substring(0,sString.length-1);
				}
				return sString;
		}
	
		function checkPhone(source, arguments){
		
			if (checkNo(document.getElementById("ctl00_ContentPlaceHolder1_txtPhone").value))
			{
			
			
			}else
			{
			arguments.IsValid=false;
			
			}
		}
		function checkMobile(source, arguments){
		
			if (checkNo(document.getElementById("ctl00_ContentPlaceHolder1_txtMobile").value))
			{
			
			
			}else
			{
			arguments.IsValid=false;
			
			}
		}
		function checkFax(source, arguments){
		
			if (checkNo(document.getElementById("ctl00_ContentPlaceHolder1_txtFax").value))
			{
			
			
			}else
			{
			arguments.IsValid=false;
			
			}
		}
		
		function CheckServiceLoginNameWithMC(source, arguments){
			//debugger;
            var tmcUserName= trimAll(document.getElementById("ctl00_lblUsername").innerText.toUpperCase());
            var tusername=trimAll(document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value.toUpperCase());
            if(tmcUserName==tusername){
            arguments.IsValid=false;
            }
            else{
            arguments.IsValid=true;
            }	
		
			
			}
			
		
