
var timey;
function stackFunction(func, func2) {
  if (typeof func != 'function') {
    return func2;
  } else {
     return function() {
      func(this);
      func2(this);
    };
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    };
  }
}

function submitSearch(){

	var searchTerm = encodeURIComponent(document.getElementById("topsearch").value);

	if(searchTerm == '' || searchTerm == 'Search'){
		alert('You have not entered a search term');
	}else{
		document.location = "/search/"+encodeURIComponent(searchTerm)+"/page1.html";
	}
	return false;
}

function checkInitValue(obj,sPassed) { 
	if(obj.value==sPassed)	{
		obj.value="";
	} 
}
function checkIsBlank(obj,sPassed) { 
	if(obj.value=='')	{
		obj.value=sPassed;
	} 
}

function make_payment(){
	document.getElementById("paymentForm").style.display = "none";
	document.getElementById("progress").style.display = "block";
	return true;
}

function wishlist_login(){
	var chkLogin = document.getElementById('chkLogin').innerHTML;
	if(chkLogin == 'Login'){
		loggedIn = 0;
	}else{
		loggedIn = 1;
	}

	if(loggedIn == 1){
		//go to wishlist page
		document.location = '/wish-list.html';
	} else {
		if(layerShowing == null){
			showLayer('login');
		}
		timey = setTimeout("wishlist_login();",1000);
	}
	return false;
}

function track_order_login(){
	var chkLogin = document.getElementById('chkLogin').innerHTML;
	if(chkLogin == 'Login'){
		loggedIn = 0;
	}else{
		loggedIn = 1;
	}

	if(loggedIn == 1){
		document.location = '/track-order.html';
	} else {
		if(layerShowing == null){
			showLayer('login');
		}
		timey = setTimeout("track_order_login();",1000);
	}
	return false;
}


