
function swapImage(imgN,imgU){
if(document.images)document.images[imgN].src=imgU;
}

 

function checkvalid() {
	if(myform.newpass.value != myform.newpass2.value) {
		alert('New Password and Confirm Password should be the same');
		myform.newpass.focus();
	} else
	{
		myform.submit();
	}
}

/* <<<<<<<<<<<<<index update and delete>>>>>>>>>>>>>> */
function clickUpdate()
{
	myForm.action = 'index.php?type=1';
	myForm.submit();
}
function clickDelete()
{
	myForm.action = 'index.php?type=2';
	myForm.submit();
}
/* index update and delete ends */

/*<<<<<<<<<<<<<<<<<< nespresso update and delete >>>>>>>>>>>>>*/
function clickUpdate1()
{
	myForm.action = 'nespresso_machines.php?type=1';
	myForm.submit();
}
function clickDelete1()
{
	myForm.action = 'nespresso_machines.php?type=2';
	myForm.submit();
}
/*<<<<<<<<<<<<<<<<<< nespresso update and delete ends >>>>>>>>>>>>>*/

/*<<<<<<<<<<<<<<<<<< others update and delete >>>>>>>>>>>>>>>>>>>>>*/
function clickDelete2()
{
	myForm.action = 'others.php?type=2&cat=PRODUCTS FOR DISPENSERS';
	myForm.submit();
}
function clickUpdate2()
{
	myForm.action = 'others.php?type=1&cat=PRODUCTS FOR DISPENSERS';
	myForm.submit();
}
/*<<<<<<<<<<<<<<<<<< others update and delete ends >>>>>>>>>>>>>>>>>>>>>*/

/*<<<<<<<<<<<<<<<<<< others update and delete >>>>>>>>>>>>>>>>>>>>>*/
function clickUpdate3()
{
	myForm.action = 'updateprofile.php?type=1';
	myForm.submit();
}
function clickDelete3()
{
	myForm.action = 'updateprofile.php?type=2';
	myForm.submit();
}
/*<<<<<<<<<<<<<<<<<< others update and delete ends >>>>>>>>>>>>>>>>>>>>>*/

/*<<<<<<<<<<<<<<<<<< others update and delete >>>>>>>>>>>>>>>>>>>>>*/
function clickUpdate4()
{
	myForm.action = 'order_det.php?type=1';
	myForm.submit();
}
function clickDelete4()
{
	myForm.action = 'updateprofile.php?type=2';
	myForm.submit();
}
/*<<<<<<<<<<<<<<<<<< others update and delete ends >>>>>>>>>>>>>>>>>>>>>*/

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_validateForm() { //v4.0
  var i, p, q, nm, test, num, min, max, errors='', args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { 
  
  		test=args[i+2]; val=MM_findObj(args[i]);
		
    		if (val) { 
				nm=val.name; 
				if ((val=val.value)!="") {
				
					if (test.indexOf('isEmail')!=-1) { 
					
						p=val.indexOf('@');
						
							if (p<1 || p==(val.length-1)) 
									errors+='- '+nm+' must contain an e-mail address.\n';
					} else if (test!='R') { 
						num = parseFloat(val);
						if (isNaN(val)) 
							errors+='- '+nm+' must contain a number.\n';
							if (test.indexOf('inRange') != -1) { 
								p=test.indexOf(':');
								min=test.substring(8,p); 
								max=test.substring(p+1);
								if (num<min || max<num) 
									errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
							} 
					} 
				} else if (test.charAt(0) == 'R') 
					errors += '- '+nm+' is required.\n'; 
			}
  } 
  if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
}



function toggledisplay(setobject)
{
	
  if(document.getElementById(setobject).style.display == 'block') {
     document.getElementById(setobject).style.display = 'none';     
  }
  else {
     document.getElementById(setobject).style.display = 'block';
     
  }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function clickme() {
  document.getElementById('details').style.display="block";
}

function clearField(){
document.form1.fablist.value = "";
document.form1.fablist.focus();
}

function ajaxFunction(strurl) {
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");  
	  }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
	document.getElementById('weavediv').innerHTML=xmlHttp.responseText;
      }
    if(xmlHttp.readyState <= 3)
      {
	document.getElementById('weavediv').innerHTML = "<img src='loader.gif'/>";
      }      
    }
  xmlHttp.open("GET",strurl,true);
  xmlHttp.send(null);
}

function forgotpwd(){
	if (document.form.email.value==""){
		alert("Please enter your email address.");
		document.form.email.focus();
		return false;
		}
	else if (document.form.email.value.indexOf("@")==-1){
		alert("Please enter a valid email address.\nExample: yourname@yourcompany.com");
		document.form.email.focus();
		return false;
		}
	else if (document.form.email.value.indexOf(".")==-1){
		alert("Please enter a valid email address.\nExample: yourname@yourcompany.com");
		document.form.email.focus();
		return false;
		}			
}
 
	

