$(document).ready(function(){


	$('a[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});


});




function validateCard(form)
{
	if(form.creditcardnumber.value=='')
	{
		alert("Please Enter Your Credit Card Number");
		form.creditcardnumber.focus();
		return false;
	}

	if(form.creditcardexpiry.value=='')
	{
		alert("Please Enter Your Credit Card Expiry Date");
		form.creditcardexpiry.focus();
		return false;
	}


	var cleanedCC = stripAlpha(form.creditcardnumber.value);
	var cleanedEx = stripAlpha(form.creditcardexpiry.value);

	form.creditcardnumber.value = cleanedCC;
	form.creditcardexpiry.value = cleanedEx;


	var checkCard = isValidCardNumber(form.creditcardnumber.value);


	if(!checkCard)
	{
		alert("Invalid Credit Card Number");
		return false;
	} else {
		return true;
	}	

}


function stripAlpha(s) 
{ 
	var strOut = new String(s); 
	strOut = strOut.replace(/[^0-9]/g, ''); 

	return strOut; 
}



function confirmDelete()
{
	var agree = confirm("Are you sure you want to DELETE this record?");

	if (agree)
		return true ;
	else
		return false ;
}



function checkFileType( fileName )
{

	var fileOK = false;

	var fileTypes = ['flv'];

	if (!fileName)
	{ 
		alert("Please select a file for uploading.");
		return false;
	}
	
	ext = fileName.split(".");

	// the part after the last period is the extension
	fileType = ext[ext.length-1].toLowerCase();

	var arLen = fileTypes.length;
	
	for ( var i=0, len=arLen; i<len; ++i )
	{
		if(fileTypes[i] == fileType )
		{
			fileOK = true;
		}
	}


	if(fileOK == true)
	{
		return true;
		
	} else {
	
		alert('Invalid File Type. Please upload only .FLV video.');
		return false;
	
	}

}


