﻿<!--
String.prototype.replaceAll  = function(s1,s2){    
return this.replace(new RegExp(s1,"gm"),s2);    
}

var vidosubmit={
    dsendurl:function(){
        var UName = $('UName').value;
        var UEmail = $('UEmail').value;
        var UCountry = $('UCountry').value;
        var TypeVGA = $('TypeVGA').checked;
        var TypeHD = $('TypeHD').checked;
        var UUrl = $('UUrl').value;
        var UTitle = $('UTitle').value;
        var UCaption = $('UCaption').value;
        var aglint = $('aglint').checked;
    
        var strd="&UName="+UName+"&UEmail="+UEmail+"&UCountry="+UCountry+"&TypeVGA="+TypeVGA+"&TypeHD="+TypeHD+"&UUrl="+UUrl+"&UTitle="+UTitle+"&UCaption="+UCaption+"&aglint="+aglint;
		return strd;
    },
    wantedurl:function(){
       var UName = $('UName').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");         
        var UEmail = $('UEmail').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");    
     var UCountry = $('UCountry').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");
      var UUrl = $('UUrl').value;
      UUrl = UUrl.replaceAll('&','%26');
      UUrl = UUrl.replaceAll('=','%3D');
      UUrl = UUrl.replaceAll('%','%25');
      UUrl = UUrl.replaceAll("\\u002B","%2B"); 
      UUrl = UUrl.replaceAll("\\u003F","%3F"); 
      UUrl = UUrl.replaceAll("#","%23"); 
        var UCaption = $('UCaption').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");        
        var strd="&UName="+UName+"&UEmail="+UEmail+"&UCountry="+UCountry+"&UUrl="+UUrl+"&UCaption="+UCaption;
		return strd;
    
    },
    wantedcheck:function(){
         var UName = $('UName').value;         
        var UEmail = $('UEmail').value;    
     var UCountry = $('UCountry').value;
      var UUrl = $('UUrl').value;
        var UCaption = $('UCaption').value;
        
           if(UName == "")
        {
            alert("Please enter your name.");
            $('UName').focus();
            return false;
        }
        if(UEmail == "")
        {
            alert("Please enter your email.")
            $('UEmail').focus();
            return false;
        }
        else
        {
            if(this.check_email(UEmail) == false)
            {
                alert('Please enter a valid email address.');
                $('UEmail').focus();
                return false;                
            }
        }
        if(UCountry == "")
        {
            alert("Please select your country.");
            $('UCountry').focus();
            return false;
        }
   
        
        if(UUrl == "")
        {
            alert("Please enter your portfolio URL.");
            $('UUrl').focus();
            return false;        
        }
        
        if(UCaption == "")
        {
            alert("Please enter a brief paragraph on why you think you should be given the sample Vado HD.");
            $('UCaption').focus();
            return false;
        }        
   
     
        return true;
        
    },
    mailurl:function(){
      var UName = $('UName').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");
        var UEmail = $('UEmail').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");
            var UUrl = $('UUrl').value.replaceAll('&','%26').replaceAll('=','%3D').replaceAll('%','%25').replaceAll("\\u002B","%2B").replaceAll("\\u003F","%3F").replaceAll("#","%23");
          var strd="&UName="+UName+"&UEmail="+UEmail+"&UUrl="+UUrl;
		return strd;   
    },
    mailcheck:function() {
        var UName = $('UName').value;  
         var UEmail = $('UEmail').value; 
          var UUrl = $('UUrl').value; 
          
             if(UName == "")
        {
            alert("Please enter your name.");
            $('UName').focus();
            return false;
        }
        if(UEmail == "")
        {
            alert("Please enter your email.")
            $('UEmail').focus();
            return false;
        }
        else
        {
            if(this.check_email(UEmail) == false)
            {
                alert('Please enter a valid email address.');
                $('UEmail').focus();
                return false;                
            }
        }
        
          if(UUrl == "")
        {
            alert("Please enter your portfolio URL.");
            $('UUrl').focus();
            return false;        
        }
        
        return true;
        
        
    },
    takefromcheck:function () {

        var UName = $('UName').value;         
        var UEmail = $('UEmail').value;        
        var UCountry = $('UCountry').value;
        var TypeVGA = $('TypeVGA').checked;
        var TypeHD = $('TypeHD').checked;
        var UUrl = $('UUrl').value;
        var UTitle = $('UTitle').value;
        var UCaption = $('UCaption').value;
        var aglint = $('aglint').checked;
           
        if(UName == "")
        {
            alert("Please enter your name.");
            $('UName').focus();
            return false;
        }
        if(UEmail == "")
        {
            alert("Please enter your email.")
            $('UEmail').focus();
            return false;
        }
        else
        {
            if(this.check_email(UEmail) == false)
            {
                alert('Please enter a valid email address.');
                $('UEmail').focus();
                return false;                
            }
        }
        if(UCountry == "")
        {
            alert("Please select your country.");
            $('UCountry').focus();
            return false;
        }
        if(TypeVGA == false && TypeHD == false)
        {
            alert("Please select a type.");
            $('TypeVGA').focus();
            return false;
        }
        
        if(UUrl == "")
        {
            alert("Please enter your portfolio URL.");
            $('UUrl').focus();
            return false;        
        }
        if(UTitle == "")
        {
            alert("Please enter your title.");
            $('UTitle').focus();
            return false;        
        }
        if(aglint == false)
        {
            alert("We can only process your registration if you agree to the Terms and Conditions.");
            $('aglint').focus();
            return false;
        } 
        return true;
    },
    mailclear:function(){
      $('UName').value = "";
      $('UEmail').value = "";
      $('UUrl').value = ""; 
    },
    takeclear:function(){
        $('UName').value = "";
        $('UEmail').value = "";
        $('UCountry').selectedIndex = 0;
        $('TypeVGA').checked = false;
        $('TypeHD').checked = false;
        $('UUrl').value = "";
        $('UTitle').value = "";
        $('UCaption').value = "";
        $('aglint').checked = false;  
    
    },
    check_email:function(email)
    {
	var reg=/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&amp;\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&amp;\¡¯\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
		if(reg.test(email))
		{
			return true;
		}
		else
		{
			return false;
		}
    },

/*grr=getResponseResult*/
	grr:function(rp){
		if(RegExp.$1)/(.*)/.exec("");
		var re=new RegExp("<result>(.*)<\/result>");
		re.exec(rp);
		if(RegExp.$1)return RegExp.$1;
		return "";
	},
	 takeajaxcoent:function () {
       var url = "videosubmit.aspx?dd=dd"; 
       var pars = "deng=2"+Math.random(); 
       var myAjax = new Ajax.Updater("take_msg", url, { method:"get", parameters:pars,onFailure  : reportError, onLoading  : loading, onComplete : done} );
	 },
	 takeajaxsend:function () {	    
		if(vidosubmit.takefromcheck())
		{
		//alert('sss');
			var option={
			parameters:"action=add&s="+Math.random()+"&oper=add"+String(vidosubmit.dsendurl()),
			method:"post",
			onSuccess:function(transport){	
				if(vidosubmit.grr(transport.responseText)=="1")
				{
					alert("Thank you, submitted to the success.");
					vidosubmit.takeclear();
				}
				else
				{
					alert("System busy, please try again later.");
				}
			},
			onFailure:function(transport){
				alert("System busy, please try again later.");
			}
			}
			var request=new Ajax.Request("/videos/videosubmit.aspx",option);
		}
	 },
	 Alertajaxsend:function () {	    
		if(vidosubmit.takefromcheck())
		{
		//alert('sss');
			var option={
			parameters:"action=add&s="+Math.random()+"&oper=add"+String(vidosubmit.dsendurl()),
			method:"post",
			onSuccess:function(transport){	
				if(vidosubmit.grr(transport.responseText)=="1")
				{
					alert("Thank you. Your request has been submitted successfully. You will be notified if you're selected.");
					AlertClose();
				}
				else
				{
					alert("System busy, please try again later.");
				}
			},
			onFailure:function(transport){
				alert("System busy, please try again later.");
			}
			}			
		}
	 },
	 AlertajaxsendMail:function() {	 
	 	if(vidosubmit.mailcheck())
		{
			var option={
			parameters:"action=addto&s="+Math.random()+"&oper=add"+String(vidosubmit.mailurl()),
			method:"post",
			onSuccess:function(transport){	
				if(vidosubmit.grr(transport.responseText)=="1")
				{
					alert("Thank you. Your request has been submitted successfully. You will be notified if you're selected.");
					vidosubmit.mailclear();
					AlertClose();
				}
				else
				{
					alert("System busy, please try again later.");
				}
			},
			onFailure:function(transport){
				alert("System busy, please try again later.");
			}
			}
			var request=new Ajax.Request("/videos/videosubmit.aspx",option);
		}
	 
	 },
	 Alertajaxsendwanted:function(){
	 	 	if(vidosubmit.wantedcheck())
		{
			var option={
			parameters:"action=addwanted&s="+Math.random()+"&oper=add"+String(vidosubmit.wantedurl()),
			method:"post",
			onSuccess:function(transport){
				if(vidosubmit.grr(transport.responseText)=="1")
				{
					alert("Thank you. Your request has been submitted successfully. You will be notified if you're selected.");
					vidosubmit.mailclear();
					AlertClose2();
				}
				else
				{
					alert("System busy, please try again later.");
				}
			},
			onFailure:function(transport){
				alert("System busy, please try again later.");
			}
			}
			var request=new Ajax.Request("/videos/videosubmit.aspx",option);
		}
	 
	 }



}

//-->

