
function fnAddCart(varProID) {
	//alert("features not implemented yet");
	//alert("Item has been added to inquiry basket");
	document.cart.submit();
	//AddCart.location = 'add_item.html?item=' + varProID;
}

function fnDelItem(pid) {

	document.cart.delItem.value = pid;
	document.cart.Action.value = "delete";
	document.cart.submit();
} 
function fnUpdate_cart(pid) {

	document.cart.Action.value = "update";
	document.cart.submit();
} 
function setTrack() {
	document.forms[1].track.value = 1;
}
function fnSubmit() {
	if(document.forms[1].track.value != 1) {
		alert("cannot submit form");
		return false;
	}
	if((document.forms[1].emailAddress.value == '') ||
	(document.forms[1].contactName.value == '') ||
	(document.forms[1].companyName.value == '')) {
		alert('Please fill out the fields that marked with a (*). \nThen, resubmit the form. \nThank You.');
		return false;
	}
	var f = document.forms[1].emailAddress;	
	apos= f.value.indexOf("@")
	dotpos= f.value.lastIndexOf(".")
	if (apos<1||dotpos-apos<2) {
		alert("Please enter a valid email address.");
		return false;
	}
	return true;
}
function fnLoadProduct(id) {
	url = "product.html?product_id="+id;
	document.location = url;
	//myWin = window.open(url, "winImg", "width=520,height=528,resizable=yes,scrollbars=yes,status=yes");
        //myWin.focus();
}
function fnLoadCatProduct(id) {
	url = "cata_product.html?product_id="+id;
	document.location = url;
	//myWin = window.open(url, "winImg", "width=520,height=528,resizable=yes,scrollbars=yes,status=yes");
        //myWin.focus();
}

function fnLoadSearchProduct(id, search, intPage) {
	//if(intPage != 0) {
		url = "product.html?product_id="+id + "&search=" + search + "&intPage=" + intPage;
	//}
	
	//url = "product.html?product_id="+id + "&search=" + search;
	document.location = url;
}
function fnLoadPage(page, intPage, varNum) {
	url = page + "?intPage=" + intPage + "&varNum=" + varNum;
	document.location = url;

}

function fnLoadPromote(id) {
	url = "http://www.toyswholesale.net/product.html?product_id="+id;
	document.location = url;
	
}


function submitPaypal(pid) {
	url = "ebay_submit.php?product_id=" + pid;
	//myiframe.document.location = url;
	document.location = url;
	
}

function viewCart(pid) {
        url = "ebay_view_cart.php?view_cart=" + pid;
        //myiframe.document.location = url;
 	document.location = url;
}
function fnLoadImage(id) {
	
	url = "/images/B/" + id + ".jpg";
	myWin = window.open(url, "winImg", "width=800,height=800,resizable=yes,scrollbars=yes,status=yes");
	myWin.focus();
    
}
function makePopup(no_pop_site)
{ // USAGE: initialize on page load using an attachEvent action
	d=document.getElementsByTagName('a');
	var popfun;
	regexp = new RegExp(no_pop_site);
	regexp2 = new RegExp("javascript");
	regexp3 = new RegExp("toy-wholesale");
	var windowAttributes='width=800,height=500,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=yes';
	if (d.length > 0) { // links are modifiable
		
		for (var i=0; i < d.length; i++) {
		
				//if(!d[i].href.match(regexp)) {
				//if(!d[i].href.match(regexp) && d[i].href != 'javascript:history.back()') {
				if(!d[i].href.match(regexp) && !d[i].href.match(regexp2)  && !d[i].href.match(regexp3) ) {
					popfun=function(){ 
       					var awin = window.open(this.href,'mywin', windowAttributes); 
       					awin.focus();
       					return false; 
     				};
					d[i].onclick=popfun; 
     				d[i].onkeypress=popfun;
				}
     		
		}
	}
}

