function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function dynURL(urltype, dest){
	var prefix = "";
	var url = "dev.myshoeshoppe.com/";
	//var url = "www.myshoeshoppe.com/";
	switch(urltype)
	{
		case "http":
			prefix = "http://";
			break;
		case "https":
			prefix = "https://";
			break;
		default:
			break;
	}
	window.location.href = (prefix + url + dest);
}

function printOrder(txid) {
	window.open("printOrder.php?TxID="+txid, "winPicture", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, width=800");
}

function picture(index, rep) {
	window.open("picture.php?index="+index+"&rid="+rep, "winPicture", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, width=800");
}

function changePicture(frm)
{
	var shoe = "";
	var color = "";
	var slgth = document.forms[frm].cmbShoe.options.length - 1;
	var clgth = document.forms[frm].cmbColor.options.length - 1;
	var i = 0;
	while (i < slgth)
	{
		if(document.forms[frm].cmbShoe.options[i].selected)
		{
			shoe = document.forms[frm].cmbShoe.options[i].text;
		}
		i = i + 1;
	}
	i = 0;
	while (i < clgth)
	{
		if(document.forms[frm].cmbColor.options[i].selected)
		{
			color = document.forms[frm].cmbColor.options[i].text;
		}
		i = i + 1;
	}
	document.forms[frm].txtSmPicture.value = 'images/gallery/' + shoe + '_' + color + '_sm.gif';
	document.forms[frm].txtLgPicture.value = 'images/gallery/' + shoe + '_' + color + '_lg.gif';
}

function edit(isParty, ID) {
	window.open("editParty.php?isParty="+isParty+"&id="+ID, "winEditPaty", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, height=400, width=800");
}

function showPartySummary(ID) {
	window.open("partySummary.php?drdParty="+ID, "winPartySummary", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, height=800, width=1000");
}

function showPartyCloseAndPay(ID) {
	window.open("partyPayAndClose.php?drdParty="+ID, "winPartySummary", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, height=800, width=1000");
}

function refreshParent() {
	window.opener.location.href = window.opener.location.href;
	if (window.opener.progressWindow)		
	{
    	window.opener.progressWindow.close()
	}
}

function address(id) {
	window.open("newAddress.php?CustomerID=" + id, "winAddress", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=1, width=800, height=400");
}

function userSearch(frm) {	
	var fname = document.forms[frm].txtFName.value;
	var lname = document.forms[frm].txtLName.value;
	var phone = document.forms[frm].txtPhone.value;
	var email = document.forms[frm].txtEmail.value;
	var btnSearch = 'Search for a Customer';
	
	window.open("userSearch.php?btnSearch="+btnSearch+"&txtFName="+fname+"&txtLName="+lname+"&txtPhone="+phone+"&txtEmail="+email, "winSearch", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=1, width=1000, height=600");
}

function transactionSearch(frm) {	
	var fname = document.forms[frm].txtFirstName.value;
	var lname = document.forms[frm].txtLastName.value;
	var id = document.forms[frm].txtOrderID.value;
	var total = document.forms[frm].txtTxTotal.value;
	var btnSearch = 'Search for a Transaction';
	
	window.open("transactionSearch.php?btnSearch="+btnSearch+"&txtOrderID="+id+"&txtFirstName="+fname+"&txtLastName="+lname+"&txtTxTotal="+total, "winSearch", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=1, width=1000, height=600");
}

function exchangeShoe(frm) {	
	var shoe = 0;

	for( i = 0; i < document.forms[frm].grpShoes.length; i++ )
	{
		if( document.forms[frm].grpShoes[i].checked == true )
			shoe = document.forms[frm].grpShoes[i].value;
	}

	window.open("exchangeShoe.php?ItemID="+shoe, "winExchange", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=1, width=1000, height=600");
}

function redirectMain(url) {
	window.opener.location.href = url;
	window.close();
}

function openEvite(frm) {
	var name = document.forms[frm].txtName.value;
	var date = document.forms[frm].txtPartyDate.value;
	var location = document.forms[frm].txtLocation.value;
	var time = document.forms[frm].txtPartyTime.value;
	var comments = document.forms[frm].taComments.value;
	window.open("evite.php?txtName="+name+"&txtPartyDate="+date+"&txtLocation="+location+"&txtPartyTime="+time+"&taComments="+comments, "winPicture", "status=0, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=0, width=900, height=650");
}

function MsgOkCancel() 
{ 
	var fRet; 
	fRet = confirm('Are you sure?'); 
	return(fRet); 
} 

function explainCommission() {
	window.open("commissionExplanation.php", "winComissionExplain", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, height=300, width=400");
}

function displayHint(intHint, intHeight, intWidth) {
	window.open("displayHint.php?hintId=" +  intHint, "winDisplayHint", "status=1, toolbar=0, location=0, menubar=0, directories=0, resizeable=1, scrollbars=1, height=" + intHeight + ", width=" + intWidth);
}
