
// JavaScript Document
// Email Signup Page
function getinfo(){

var email_address = document.maillist.email_address.value;

if(email_address == "name@email.com")
{ 
    alert("Please enter a valid email address"); 
}else{

var addy = "http://www.skynmobile.com/signup.php?email="+email_address;

window.open (addy,'MailForm','width=400,height=350');
}
}

function SelectSizeQty() {  //Checks if a size and quantity has been chosen

	if (formProduct.ADD.value==""  || formProduct.QTY.value=="") {
		alert("Please select a Size and Quantity");
		return false;
	}
//alert(window.document.formProduct.QTY.selectedIndex);		
}

function SetQty() {

window.document.formProduct.QTY.selectedIndex = 1; 

}

function checkFields(){

var email_address = document.Feedback.emailaddress.value;

if(email_address.indexOf("@") == -1 || email_address.indexOf(".") == -1)
{ 
    alert("Please enter a valid email address");
	return false;
}

}

function mailform(){

var email_address = document.mailform.email_address.value;

if(email_address == "name@email.com")
{ 
    alert("Please enter a valid email address"); 
}else{

var action = document.mailform.action.value;


if(action == "subscribe")
{
var full_name = escape(document.mailform.full_name.value);
}


var addy = "http://www.skynmobile.com/list/public/listmessenger.php?full_name='"+full_name+"'&email_address="+email_address+"&action="+action+"&group_ids[]=1";

window.open (addy,'MailForm','width=400,height=350');
}

}

function win(address,length,width) {

if(length && width){
var winlen = length;
 var winwide = width;
}else{
 var winlen = 400;
  var winwide = 450;
}

window.open (address, 'Skyn', 'width='+winwide+',height='+winlen);

}


function win2(address) {

window.open (address, 'Skyn', 'width=750,height=400,scrollbars=yes');

}

function emailtoFriend(){

sndr = emailFriend.sndr_address.value;
rcpt = emailFriend.rcpt_address.value;

	if (emailFriend.sndr_address.value=="" || !(isValidEmail(sndr)) ){
		alert("Please check your email address");
		return false;
	}else  if(emailFriend.rcpt_address.value=="" || !(isValidEmail(rcpt)) ){
		alert("Please check your friends email address");
		return false;
	}

}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}
