// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function	write_flv_player(flv_filename, playerdiv, image, autostart) {
	var s1 = new SWFObject("/movies/flvplayer.swf","single","369","297","7");
	s1.addParam("allowfullscreen","false");
	s1.addVariable("file", flv_filename);
	if (image) {s1.addVariable("image", image);};
	if (autostart) {s1.addVariable("autostart", autostart);};
	s1.write(playerdiv);
}
	
// email

function checkFromEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please make sure your email address is valid.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Your email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkToEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your friend's email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please make sure your friend's email address is valid.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Your friend's email address contains illegal characters.\n";
       }
    }
return error;    
}

// message field is not longer than 250 chars

function messageIsShort(strng) {
var error = "";
  if (strng.length > 250) {
     error = "Your message is too long. Please make it shorter than 250 characters.\n"
  }
return error;	  
}

function checkCheckBox(strng) {
	var error = "";
	if (strng.checked == false) {
		error = 'Please select the "Accept" checkbox.\n';
	}
	return error;
}



// Requires: prototype.js, scriptaculous.js?load=effects

	function copyToClipboard(elt) {
		
		elt.select();

		return true;
	}

