/*
 **********************************************
 * Name: clientLib.js
 * Desc: Main JavaScript Function Library for
 *       netlinkweb.com
 * 
 * Created: 4.19.2004 NetLink Technologies
 *          Vic Berggren ©Copyright 2004. 
 *          All Rights Reserved.
 **********************************************
 /

/* New Window Function */
function link_popup(srcURL) 
{
    sealWin = window.open(srcURL,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=165');
    self.name = "mainWin"
}

/* Main Messaging System regarding expired items targeted for deletion from the Saved OrderForm. */
function DeleteCartAlert(sku, cartID, shopperID)
{
	var msg = 'An item in your saved cart has been discontinued.\n\n\tItem: ' + sku + '\n\nWe have removed this item from your Saved Cart.';
	alert(msg);
	window.location = 'delete-item.asp?routeback=savedcart&item=' + sku + '&cartID=' + cartID + '&mscsid=' + shopperID;
}

/* Main Messaging System regarding espired items targeted for deletion from the Active OrderForm */
function DeleteAlert(sku,description,price,quanity,id,shopperID)
{
	var msg = 'An item in your shopping card has been discontinued.\n\n\tItem: ' + sku + ' \n\tDescription: ' + description + ' \n\tPrice: ' + price + '\n\tQuanity: ' + quanity + '\n\nWe have removed this item from your Shopping Cart.';
	alert(msg);
	window.location = 'xt_orderform_delitem.asp?index=' + id + '&mscsid=' + shopperID;
}

/* Main Length Validation mechanism */
function IsValidLength(item, len)
{
    return (item.length >= len);
}

/* Main Email Validation Mechanism */
function IsValidEmail(emailad) 
{
    var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
    var check=/@[\w\-]+\./;
    var checkend=/\.[a-zA-Z]{2,3}$/;

	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1))
	{
		return (false);
	}
	else 
	{
		return (true);
	}
}