function copy(stoput) {
    var inElement=document.createElement("input");
    inElement.type="text";
    inElement.style.display="none";
    inElement.value=stoput;
    document.body.appendChild(inElement);
    if (inElement.createTextRange) {
        var range = inElement.createTextRange();
        if (range && BodyLoaded==1) range.execCommand('Copy');
    } else {
        var flashcopier = 'flashcopier';
        if(!document.getElementById(flashcopier)) {
            var divholder = document.createElement('div');
            divholder.id = flashcopier;
            document.body.appendChild(divholder);
        }
        document.getElementById(flashcopier).innerHTML = '';
        var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
        document.getElementById(flashcopier).innerHTML = divinfo;
    }
    inElement.parentNode.removeChild(inElement);
}


  function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmtellafrienddeal.friendemail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your friends e-mail address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	var emailID2=document.frmtellafrienddeal.email
	
	if ((emailID2.value==null)||(emailID2.value=="")){
		alert("Please Enter your e-mail address")
		emailID2.focus()
		return false
	}
	if (echeck(emailID2.value)==false){
		emailID2.value=""
		emailID2.focus()
		return false
	}

	var validationusertext=document.frmtellafrienddeal.validation
	var validationvalid=document.frmtellafrienddeal.valid
	
	if ((validationusertext.value==null)||(validationusertext.value=="")){
		alert("Please type in the security code")
		validationusertext.focus()
		return false
	}
	
	if (validationusertext.value!=validationvalid.value){
		alert("The security code does not match, please try again.")
		validationusertext.focus()
		return false
	}

	return true
 }
 
 