function SetFocus() {
  if (document.forms.length > 0) {
    var field = document.forms[0];
    for (i=0; i<field.length; i++) {
      if ( (field.elements[i].type != "image") &&
           (field.elements[i].type != "hidden") &&
           (field.elements[i].type != "reset") &&
           (field.elements[i].type != "submit") ) {

        document.forms[0].elements[i].focus();

        if ( (field.elements[i].type == "text") ||
             (field.elements[i].type == "password") )
          document.forms[0].elements[i].select();

        break;
      }
    }
  }
}

function rowOverEffect(object) {
  if (object.CLASSName == 'dataTableRow') object.CLASSName = 'dataTableRowOver';
}

function rowOutEffect(object) {
  if (object.CLASSName == 'dataTableRowOver') object.CLASSName = 'dataTableRow';
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function checkPW(OrderID)
{
//EmailForm
	if(document.EmailForm.EmailPW.value=="")
			{
			alert("You need to insert the Password!");
			return false;
			}
	if(document.EmailForm.EmailPW.value!="OKEmailUK")
		{
			alert("Wrong Password!");			
			return false;
	}

	if(document.EmailForm.EmailPW.value=="OKEmailUK")
	{
	//open Order Email Window
	// yes I use Dreamweaver code too, so what?	
	MM_openBrWindow('email_panel.php?Action=UK&OrderID='+OrderID,'Emails','width=600,height=600, Top=0, Left=0');
	}
}

function checkCustEmail(OrderID)
{
	if (document.EmailForm.CustEmail.value=="")
		{
			alert("You can not email this customer, because there is no email address.");
			return false;
		}
		else
		{
		MM_openBrWindow('email_panel.php?Action=Customer&OrderID='+OrderID,'Emails','width=800,height=600, Top=0, Left=0,status=Yes');
		
		}

}

function checkStaff(OrderID)
{
	if(document.EmailForm.Staff.options.selectedIndex == 0)
	{
	
	alert("Please select a Staff member from the list");
	return false;
	
	}
	else 
	{
	var Recepient=document.EmailForm.Staff.value;
	MM_openBrWindow('email_panel.php?Action=Staff&OrderID='+OrderID+'&Recepient='+Recepient,'Emails','width=600,height=600, Top=0, Left=0');
	}
}

function getTemplate(Name,RMA,CustName)

{
	document.form1.Content.value="";
	document.form1.Content.value="Dear " +CustName+ ":\r"; 
	if(document.form1.Templates.value=="1")
	{
		document.form1.Content.value += 
	 	"We have received the order you recently placed online. However your transaction has been declined.\r"+
	"If you want us  to attempt to process your credit card again please let us know by sending us an email.\r"+
	"If you prefer to cancel the order and place it again  just go online and place your order, your former order  will be automatically cancelled.\r"+
	"\r\r\r"+
	"Best regards\r"+
	"Ana Villa\r"+
	"To retry or cancel your order email us at id@merconnet.com\r"+
	"Tel: 514-4810709";
	}
	if(document.form1.Templates.value=="2")
	{
	 document.form1.Content.value += 
	"We have received the order# "+OrderID+"you placed recently in our website.\r"+
	"For security reasons and in order to protect our customers and ourselves  we are obligated to ask you for some  extra identification.\r"+
	"Please kindly send us via email or fax:\r"+
	"1.	A copy of your last bank statement showing your billing address,  or,\r"+
	"2.	A copy of your phone bill showing the billing address,  or,\r"+
	"3.	A copy of your credit card both sides and the three (3) digits security number in the back\r"+
	"\r"+
	"Please make sure that the name of the ID matches with the one on your credit card.\r"+
	"We appreciate your patience and please understand that this is done for your security and ours\r"+
	"Feel free to contact us at any time. Our toll free number is 1 877-550-3529 or 514-4810709\r"+
	"\r"+
	"Best regards \r"+
	"Ana M. Villa \r"+
	"Customer Service Representative\r"+
	"http://www.merconnet.com\r"+
	"";
	
	}
	
	if(document.form1.Templates.value=="3")
	{
		document.form1.Content.value += 
		"We have received the order# "+OrderID+"you placed recently in our website.\r"+
		"However the item you ordered is out of stock  until / / \r"+
		"As soon as we have it in stock we will inform you and we will charge your order after you authorize us to do so.\r"+
		"If you have any questions please let us  know.\r"+
		"Sorry for the inconvenience\r"+
		"\r"+
		"Best regards \r"+
		"Ana M. Villa \r"+
		"Customer Service Representative\r"+
		"http://www.merconnet.com\r"+
		"";

	}
	
	
	if(document.form1.Templates.value=="4")
	{
	document.form1.Content.value += 
	"Your Replacement has been approved. Your RMA# is: "+RMA+ "\r"+
	"Please return ALL ITEMS (box included) to the following address:"+ "\r"+
	"Merconnet UK (RMA#"+RMA+")"+ "\r"+
	"Deanland Road. Golden Cross."+ "\r"+
	"East Sussex. BN27 3RP.UK"+ "\r"+
	"Tel: 01825874100"+ "\r\r\r"+
	"Make sure to indicate the RMA# clearly on the outside of the package."+ "\r"+
	"If you are mailing from the UK, please be sure to write \"defective item returned for replacement, no commecial value\""+ "\r"+
	"on any customs form you may be asked to filled out. "+ "\r"+
	"Otherwise, write this on the outside of the package."+ "\r"+
	"We will contact you if we expect any significant delay. As per our warranty policy we do not refund shipping charges."+ "\r"+
	"Regards,"+ "\r"+
	"Merconnet team."+ "\r"+
	"RMA@merconnet.com"+ "\r"+
	"";
	}

	if(document.form1.Templates.value=="5")
	{
	document.form1.Content.value += 
	"Your refund has been approved. Your RMA# is: "+RMA+ "\r"+
	"Please return ALL ITEMS (box included) to the following address:"+ "\r"+
	"Merconnet UK (RMA#"+RMA+")"+ "\r"+
	"Deanland Road. Golden Cross."+ "\r"+
	"East Sussex. BN27 3RP.UK"+ "\r\r"+
	"Tel: 01825874100"+ "\r\r\r"+
	"Make sure to indicate the RMA# clearly on the outside of the package."+ "\r"+
	"If you are mailing from the UK, please be sure to write \"defective item returned for refund, no commecial value\""+ "\r"+
	"on any customs form you may be asked to filled out. "+ "\r"+
	"Otherwise, write this on the outside of the package."+ "\r"+
	"We will contact you if we expect any significant delay. As per our warranty policy we do not refund shipping charges."+ "\r"+
	"Regards,"+ "\r"+
	"Merconnet team."+ "\r"+
	"RMA@merconnet.com"+ "\r"+
	"";
 	
	}
 
	if(document.form1.Templates.value=="6")
	{
	document.form1.Content.value += 
		"Your replacement has been approved. Your RMA# is: "+RMA+ "\r"+
	"Please return ALL ITEMS (box included) to the following address:"+ "\r"+
	"Merconnet"+"\r"+
	"4999 St Catherine Street Ouest,Office 350"+ "\r"+
	"(RMA#"+RMA+")"+ "\r"+
	"Montreal, Quebec, Canada"+ "\r"+
	"H3Z 1T3"+ "\r\r\r"+
	"Make sure to indicate the RMA# clearly on the outside of the package."+ "\r"+
	"If you are mailing from the United States, please be sure to write \"defective item returned for replacement, no commecial value\""+ "\r"+
	"on any customs form you may be asked to filled out. "+ "\r"+
	"Otherwise, write this on the outside of the package."+ "\r"+
	"We will contact you if we expect any significant delay. As per our warranty policy we do not refund shipping charges."+ "\r"+
	"Regards,"+ "\r"+
	"Merconnet team."+ "\r"+
	"RMA@merconnet.com"+ "\r"+
	"";
	}
	
	if(document.form1.Templates.value=="7")
	{
	document.form1.Content.value += 
		"Your refund has been approved. Your RMA# is: "+RMA+ "\r"+
	"Please return ALL ITEMS (box included) to the following address:"+ "\r"+
	"Merconnet"+"\r"+
	"#311, 9319 Univercity Crescent"+ "\r"+
	"(RMA#"+RMA+")"+ "\r"+
	"Burnaby. BC, Canada"+ "\r"+
	"V5A4Y5"+ "\r\r\r"+
	"Make sure to indicate the RMA# clearly on the outside of the package."+ "\r"+
	"If you are mailing from the United States, please be sure to write \"defective item returned for replacement, no commecial value\""+ "\r"+
	"on any customs form you may be asked to filled out. "+ "\r"+
	"Otherwise, write this on the outside of the package."+ "\r"+
	"We will contact you in case of any inconvenience when refund your money. As per our warranty policy we do not refund shipping charges."+ "\r"+
	"Please allow two weeks for the refund to be shown on your credit card statement."+ "\r"+
	"Regards,"+ "\r"+
	"Fabian Garcia"+ "\r"+
	"support@merconnet.com"+ "\r"+
	"";
	}
}

