function CheckContactUsForm(MyForm)
{
ErrorMessage='';
Code=MyForm.Code.value;
if(Code != '123earth')
	{
	//document.getElementById('Code').className = 'redTD';
	ErrorMessage+='Please Enter Correct Security Code\n';
	}	
if(ErrorMessage == '')
	{
	MyForm.submit();
	}
else
	{
	alert(ErrorMessage);
	}
}

function TrakIt(ThisSrc)
{
//script = document.createElement( 'script' );
//script.src = 'https://www.naturalfootwear.com/phpscripts/pagetraker.php?Page='+ThisSrc;
//document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function SizeSearch(Gender,Size)
{
document.getElementById('InvSizes').innerHTML = "Getting All available Sizes...";	
var url =SITE+'/phpscripts/AvailableSizeSearch.php?action=go&Gender='+Gender+'&Size='+Size;	
script = document.createElement( 'script' );
script.src = url;
document.getElementsByTagName( 'head' )[0].appendChild( script );	
}

function SwapColor(ColorCode,Style,ColorDesc,Gender,SubCat)
{
document.getElementById('ColorName').innerHTML = ColorDesc;
ProdN=Gender+' '+Style+' '+ColorDesc;
document.getElementById('ProductName').innerHTML = ProdN;
//alert(Style);
document.getElementById('ImgSwap').innerHTML = "Getting New Image...";	
GetAvailableSizes(ColorCode,Style,Gender);
script = document.createElement( 'script' );
script.src = SITE+'/phpscripts/ProductHandler.php?action=GetNewColorPic&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&SubCat='+SubCat;
//alert(script.src);
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function SwapView(ColorCode,Style,Gender,View)
{
document.getElementById('ImgSwap').innerHTML = "Getting New Image...";	
script = document.createElement( 'script' );

script.src = SITE+'/phpscripts/ProductHandler.php?action=GetNewViewPic&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&View='+View;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function GetSelectedColorName(ColorDesc)
{
document.getElementById('ColorName').innerHTML = ColorDesc;
}

function GetColorMini(ColorCode,Style,ColorDescription,Gender)
{
script = document.createElement( 'script' );
script.src = SITE+'/phpscripts/ProductHandler.php?action=GetNewColorPicMini&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&DivID='+Style;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}


function GetAvailableSizes(ColorCode,Style,Gender,Availability)
{
//alert(ColorCode);
document.getElementById('AvailableSizes').innerHTML = 'Please wait, loading available sizes...';
script = document.createElement( 'script' );
Loc=SITE+'/phpscripts/ProductHandler.php?action=AvailableSizes&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&Availability='+Availability
//alert(Loc);
script.src =Loc ;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function LoadMiniCart()
{
script = document.createElement( 'script' );
script.src = SITE+'/NewCart/CartHandler.php?action=LoadMiniCart';
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function SelectSize(SKU)
{
//alert(SKU);
if(SKU != '')
	{document.getElementById('SelectedSize').innerHTML = '<input type=hidden id=UPC12digit name=sku value='+SKU+'>';}

}

var whosChanged = null;
function ChangeColor(el)
{
el.style.backgroundColor = "#FE3000";
el.style.color = "#000000";
if (whosChanged != null)
{
whosChanged.style.backgroundColor = ""
whosChanged.style.color = ""
}
whosChanged = el;
}

function AddToCart(Action)
{		

	if(document.getElementById('UPC12digit'))
		{
		document.getElementById('superminicart').innerHTML = "<img src=\"'+SITE+'/images/AddingBag.jpg\">";
	  document.getElementById('ImgSwap').innerHTML = "<h1><font color=\"#138816\">Adding to cart...</font></h1>";
		var UPC12digit = document.getElementById('UPC12digit').value;			
		var Qty = document.getElementById('Qty').value;	
		//alert(UPC12digit);
		script = document.createElement( 'script' );
		TheScriptCall=SITE+'/NewCart/CartHandler.php?action='+Action+'&sku='+UPC12digit+'&Qty='+Qty;
		//alert(TheScriptCall);
		script.src = TheScriptCall;
		document.getElementsByTagName( 'head' )[0].appendChild( script );
		}
	else
		{
		alert('Please Choose a size.');
		}
}

function TrakPage()
{
//Link='https://'+SITE+'/pagetraker.php?Page='+window.location+'&Referer='+window.history.previous;
//script = document.createElement( 'script' );
//script.src =Link;
//document.getElementsByTagName( 'head' )[0].appendChild( script );
}
//TrakPage();

function LoadStyleDropDown()
{
var url =SECURESITE+'/phpscripts/ProductHandler.php?action=LoadStyleDropDown';	
script = document.createElement( 'script' );
script.src = url;
document.getElementsByTagName( 'head' )[0].appendChild( script );		
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) /1.1;
	var wint = (screen.height - h) / 5;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features?
    winFeatures = "," + winFeatures+',';
  else
    winFeatures = ""
  //window.open('jex5.htm','mywindow','width=400,height=200,left=0,top=100,screenX=0,screenY=100')
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += 'width='+winWidth+',height='+ winHeight+',left='+ winLeft+',top='+ winTop;
  else
    winFeatures += 'width='+winWidth+',height='+ winHeight+',left='+d_winLeft+',top='+ d_winTop
  //alert(winFeatures);
  popWin = window.open(winURL, winName, winFeatures)
  }
  
  
function closePopWin(){    // close pop-up window if it is open
  if (navigator.appName != "Microsoft Internet Explorer"
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close()
  }


function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }