/*//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
function clickIE4()
{
if (event.button==2)
{
//alert(message);
return false;
}
}
function clickNS4(e)
{
if (document.layers||document.getElementById&&!document.all)
{
if (e.which==2||e.which==3)
{
//alert(message);
return false;
}
}
}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById)
{
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("return false")
*/
function salsaclass_head(url) {
	document.write('<embed src="' + url + '" width="750" height="150" loop="true" play="true" quality="high" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
}
function salsaclass_topright(url) {
	document.write('<embed src="' + url + '" width="282" height="86" loop="true" play="true" quality="high" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
}
function salsaclass_left(url) {
	document.write('<embed id="leftbanner" src="' + url + '" width="155" height="600" loop="true" play="true" quality="high" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
}
function send2friendpage(page) {
	var newwin = window.open(page + "?url=" + escape(document.location.href), "send2friend", "width=400,height=300,location=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0,titlebar=0")
}
function embedplayer(path, file, folder) {
	if (getCookie("web") == "") {
		file = "";
	}
	else if (getCookie("web") == "true") {
		if (path == 1) {
			//file = "mms://venus.planetstream.net/salsa/" + folder + "/" + file;
			file = "mms://wms.16CC.planetstream.net/0016CC/media_files/" + file;
		}
		else {
			file = "videos/" + file;
		}
	}
	x = ('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id="mediaplayer2" type="application/x-oleobject">');
	x = x + '<param name="AutoStart" value="1" />';
	x = x + '<param name="ShowControls" value="1" />';
	x = x + '<param name="SendPlayStateChangeEvents" value="1" />';
	x = x + '<param name="ShowStatusBar" value="1" />';
	x = x + '<param name="ShowDisplay" value="0" />';
	x = x + '<param name="uiMode" value="none" />';
	x = x + '<param name="AutoRewind" value="1" />';
	x = x + '<param name="PlayCount" value="1" />';
	x = x + '<param name="EnableContextMenu" value="0" />';
	x = x + '<param name="fullScreenMode" value="0" />';
	x = x + '<param name="Filename" value="' + file + '" />';

	x = x + '<embed type="application/x-mplayer2" id="embedplayer" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" filename="' + file + '" autostart="1" showcontrols="1" showstatusbar="1" showdisplay="0" autorewind="1" playcount="1 displaysize="2" enablecontextmenu="0" fullscreenmode="0"></embed>';
	x = x + '</object>';
	document.write(x);
}
function checkNumber(e) {
	var keycode;
	var numcheck;

	if (window.event) // IE
	{
		keycode = e.keyCode;
	}
	else if (e.which) // Netscape/Firefox/Opera
	{
		keycode = e.which;
	}
	if (keycode >= 48 && keycode <= 57 || keycode >= 96 && keycode <= 105 || keycode == 8 || keycode == 46 || keycode >= 37 && keycode <= 40) {
		return true;
	}
	else {
		return false;
	}
}
function checkPrice(e, textx) {
	var keycode;
	var keychar;
	var numcheck;
	textx = textx + "xxx";
	if (window.event) // IE
	{
		keycode = e.keyCode;
	}
	else if (e.which) // Netscape/Firefox/Opera
	{
		keycode = e.which;
	}
	if (keycode >= 48 && keycode <= 57 || keycode >= 96 && keycode <= 105 || keycode == 8 || keycode == 46 || keycode == 110 || keycode == 190 || keycode >= 37 && keycode <= 40) {
		return true;
	}
	else {
		return false;
	}
}
function checkPriceproper(e, textx) {
	var keycode;
	var keychar;
	var numcheck;
	textx = textx + "xxx"
	if (window.event) // IE
	{
		keycode = e.keyCode
	}
	else if (e.which) // Netscape/Firefox/Opera
	{
		keycode = e.which
	}
	if (keycode >= 48 && keycode <= 57 || keycode >= 96 && keycode <= 105 || keycode == 8 || keycode == 46 || keycode >= 37 && keycode <= 40) {
		return true;
	}
	else {
		if (keycode == 110 || keycode == 190) {
			if (textx.match(".") == null) {
				//  keychar = String.fromCharCode(keycode)
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}
	}
}
function emailCheck(emailStr) {

	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD = 1;

	/* The following is the list of known TLDs that an e-mail address must end with. */
	var knownDomsPat = /^(arpa|root|aero|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|travel|xxx)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */
	var emailPat = /^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */
	var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/
	var validChars = "\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */
	var quotedUser = "(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */
	var atom = validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */
	var word = "(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user
	var userPat = new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */
	var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$");

	/* Finally, let's start trying to figure out if the supplied address is valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {

		/* Too many/few @'s or something; basically, this address doesn't
		even fit the general mould of a valid e-mail address. */
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user = matchArray[1];
	var domain = matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i = 0; i < user.length; i++) {
		if (user.charCodeAt(i) > 127) {
			alert("Ths username contains invalid characters.");
			return false;
		}
	}
	for (i = 0; i < domain.length; i++) {
		if (domain.charCodeAt(i) > 127) {
			alert("Ths domain name contains invalid characters.");
			return false;
		}
	}

	// See if "user" is valid 
	if (user.match(userPat) == null) {

		// user is not valid
		alert("The username doesn't seem to be valid.");
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */
	var IPArray = domain.match(ipDomainPat);
	if (IPArray != null) {

		// this is an IP address
		for (var i = 1; i <= 4; i++) {
			if (IPArray[i] > 255) {
				alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}

	// Domain is symbolic name.  Check if it's valid.
	var atomPat = new RegExp("^" + atom + "$");
	var domArr = domain.split(".");
	var len = domArr.length;
	for (i = 0; i < len; i++) {
		if (domArr[i].search(atomPat) == -1) {
			alert("The domain name does not seem to be valid.");
			return false;
		}
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */
	if (checkTLD && domArr[domArr.length - 1].length != 2 &&
domArr[domArr.length - 1].search(knownDomsPat) == -1) {
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len < 2) {
		alert("This address is missing a hostname!");
		return false;
	}
	// If we've gotten this far, everything's valid!
	return true;
}

function calculate(carriageid) {
	var total
	var desc
	total = 0
	desc = ""
	for (i = 1; i <= document.getElementById("dvdcount").value; i++) {
		priceid = "price" + i
		qtyid = "qty" + i
		dvdcode = "dvdcode" + i
		//total=total+(price*qty)
		total = total + (document.getElementById(priceid).value * document.getElementById(qtyid).value)
		if (document.getElementById(qtyid).value > 0) {
			desc = desc + document.getElementById(dvdcode).value + " x " + parseInt(document.getElementById(qtyid).value) + " - "
		}
	}
	total = total + (document.getElementById("mischarges").value * 1)
	desc = desc + "Miscellaneous charges: &pound;" + document.getElementById("mischarges").value
	total = total + (document.getElementById("carriage_amount").value * 1)

	total = Number(total)
	total = roundOff(total)
	if (total >= 0) {
	}
	else {
		total = 0
	}
	document.getElementById("cost").value = total
	document.getElementById("desc").value = desc
}
function typeOfCarriage(whereabouts) {
	document.getElementById("carriage_amount").value = whereabouts;
}
function checkbasicprice() {
	if (document.getElementById("cost").value == 0 || document.getElementById("cost").value == "") {
		alert("Please enter the quantities of DVD's you would like.")
		return false
	}
	else {
		if (document.getElementById("carriagetype").selectedIndex == 0) {
			alert("Please choose the destination to delivery to.")
			return false
		}
		else {
			alert("All DVD's are posted 'registered', which means it requires a signature. If you do not recieve your DVD's within 14 days, please contact your local post office who will be holding your package.")
			document.forms["dvdForm"].action = "https://select.worldpay.com/wcc/purchase"
			document.forms["dvdForm"].submit();
			return true
		}
	}
}
function roundOff(value) {
	if (value == 0) {
		return "0";
		exit;
	}
	precision = 2;
	value = "" + value //convert value to string
	precision = parseInt(precision);
	var whole = "" + Math.round(value * Math.pow(10, precision));
	var decPoint = whole.length - precision;
	if (decPoint != 0) {
		result = whole.substring(0, decPoint);
		result += ".";
		result += whole.substring(decPoint, whole.length);
	}
	else {
		result = whole;
	}
	return result;
}
function displayimage() {
	z = document.getElementById("image");
	if (z != null) {
		x = parseInt(z.width)
		a = 545
		if (x >= a) {
			z.width = a
		}
	}
}
function rollover(buttonid, image) {
	document.getElementById(buttonid).src = image
}
function clearfield(fieldid) {
	if (document.getElementById(fieldid).value == document.getElementById(fieldid).defaultValue) {
		document.getElementById(fieldid).value = ""
	}
}
function unclearfield(fieldid, email) {
	if (email) {
		if (document.getElementById(fieldid).value == "" || document.getElementById(fieldid).value == document.getElementById(fieldid).defaultValue) {
			document.getElementById(fieldid).value = document.getElementById(fieldid).defaultValue
		}
		else {
			emailCheck(document.getElementById(fieldid).value)
		}
	}
	else {
		if (document.getElementById(fieldid).value == "") {
			document.getElementById(fieldid).value = document.getElementById(fieldid).defaultValue
		}
	}
}
function regrequiredfield() {
	var themessage = "You are required to complete the following fields: ";
	if (document.getElementById("fname").value == "") {
		themessage = themessage + " - First Name";
	}
	if (document.getElementById("lname").value == "") {
		themessage = themessage + " - Last Name";
	}
	if (document.getElementById("username").value == "") {
		themessage = themessage + " -  User Name";
	}
	if (document.getElementById("email").value == "") {
		themessage = themessage + " -  E-mail Address";
	}
	//alert if fields are empty and cancel form submit
	if (themessage == "You are required to complete the following fields: ") {
		return true;
	}
	else {
		alert(themessage);
		return false;
	}
}
function usernamecheck() {
	username = document.getElementById("username").value
	if (username.length >= 8 && username.length <= 12) {
		return true;
	}
	else {
		alert("'User Name' must be 8-12 characters long.")
		return false;
	}
}
function validateregform(action, form) {
	if (regrequiredfield() && emailCheck(document.getElementById('email').value) && usernamecheck()) {
		document.getElementById(form).action = action
		document.getElementById(form).submit()
	}
	else {
		return false;
	}
}
function validateeditform(action, form) {
	if (editrequiredfield() && emailCheck(document.getElementById('email').value) && usernamecheck()) {
		document.getElementById(form).action = action
		document.getElementById(form).submit()
	}
	else {
		return false;
	}
}
function editrequiredfield() {
	var themessage = "You are required to complete the following fields: ";
	if (document.getElementById("fname").value == "") {
		themessage = themessage + " - First Name";
	}
	if (document.getElementById("lname").value == "") {
		themessage = themessage + " - Last Name";
	}
	if (document.getElementById("username").value == "") {
		themessage = themessage + " -  User Name";
	}
	if (document.getElementById("email").value == "") {
		themessage = themessage + " -  E-mail Address";
	}
	//alert if fields are empty and cancel form submit
	if (themessage == "You are required to complete the following fields: ") {
		return true;
	}
	else {
		alert(themessage);
		return false;
	}
}
function send2friendrequiredfield() {
	var themessage = "You are required to complete the following fields: ";
	if (document.getElementById("friendsname").value == "") {
		themessage = themessage + " - Friend's Name";
	}
	if (document.getElementById("friendsemail").value == "") {
		themessage = themessage + " - Friend's Email";
	}
	if (document.getElementById("myname").value == "") {
		themessage = themessage + " - Your Name";
	}
	if (document.getElementById("myemail").value == "") {
		themessage = themessage + " - Your Email";
	}
	//alert if fields are empty and cancel form submit
	if (themessage == "You are required to complete the following fields: ") {
		return true;
	}
	else {
		alert(themessage);
		return false;
	}
}
function validatesend2friendform(action, form) {
	if (send2friendrequiredfield() && emailCheck(document.getElementById('friendsemail').value) && emailCheck(document.getElementById('myemail').value)) {
		document.getElementById(form).action = action
		document.getElementById(form).submit()
	}
	else {
		return false;
	}
}
function validatecontactform() {
	if (contactformrequiredfield() && emailCheck(document.getElementById('liame').value)) {
		return true;
	}
	else {
		return false;
	}
}
function contactformrequiredfield() {
	var themessage = "";
	if (document.getElementById("name").value == "") {
		themessage = themessage + "\n - Name";
	}
	if (document.getElementById("liame").value == "") {
		themessage = themessage + "\n - Email Address";
	}
	if (document.getElementById("subject").value == "") {
		themessage = themessage + "\n - Email Subject";
	}
	if (document.getElementById("comments").value == "") {
		themessage = themessage + "\n - Your Comments";
	}
	//alert if fields are empty and cancel form submit
	if (themessage == "") {
		return true;
	}
	else {
		alert("You are required to complete the following fields: " + themessage);
		return false;
	}
}
function getCookie(c_name) {
	if (document.cookie.length > 0) {
		c_start = document.cookie.indexOf(c_name + "=")
		if (c_start != -1) {
			c_start = c_start + c_name.length + 1
			c_end = document.cookie.indexOf(";", c_start)
			if (c_end == -1) c_end = document.cookie.length
			return unescape(document.cookie.substring(c_start, c_end))
		}
	}
	return ""
}
function externalLinks() {
	if (!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
			anchor.title = (anchor.title != "") ? anchor.title + " (opens in a new window)" : "opens in a new window";
			anchor.className = (anchor.className != '') ? anchor.className + ' external' : 'external';
		}
	}
}
function init() {
	externalLinks();
	/*	left=document.getElementById("left")
	content=document.getElementById("content")
	if (left!=null && content!=null)
	{
	if (left.offsetHeight>content.offsetHeight)
	{
	var nh = Math.max(left.offsetHeight, content.offsetHeight); 
	content.style.height=nh
	//alert(left.offsetHeight & " " & content.offsetHeight)
	}
	}*/
}
window.onload = init;