function showNetworkInfo(nName, nAddress, xCord, yCord)
{
	document.getElementById('networkInfoLayer').style.display = '';
	document.getElementById('networkInfoLayer').style.left = xCord + 'px';
	document.getElementById('networkInfoLayer').style.top = yCord + 'px';
	document.getElementById('networkInfoLayer').innerHTML = "<b><li>"+nName+"</b><br>" + nAddress + "<br>";
}

function hideNetworkInfo()
{
	document.getElementById('networkInfoLayer').style.display = 'none';
	document.getElementById('networkInfoLayer').innerHTML = "";;
}	

var mzHelpWindow;

function showQuickEnquiryWindow(enquiryPath)
{	
	mzHelpUrl = enquiryPath+"##"+document.URL;	
	
	if (mzHelpWindow) {
  		if ( (mzHelpWindow.closed) && (window.name != "mzHelpWindowName") ) {
  			mzHelpWindow = window.open(mzHelpUrl, "mzHelpWindowName", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, top=100, left=50, width=900, height=500");
		}
	} else {
		mzHelpWindow = window.open(mzHelpUrl, "mzHelpWindowName", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, top=100, left=50, width=900, height=500");
	}
}


// Function to Check all the Checkbox's present before the records listed
function checkFunc(CheckBoxControl)
{	  
	if (CheckBoxControl.checked == true) {
		var a = 0;
		
		for (i=0; i<document.listView.elements.length; i++) {
			if (document.listView.elements[i].type == "checkbox") {
				document.listView.elements[i].checked=true;
				a = a + 1;
			}
		}
		a = a - 1;
		document.getElementById("selectCount").innerHTML = a;		
		if (document.getElementById("selectCount1"))	document.getElementById("selectCount1").innerHTML = a;				
	} else {
		for (i=0; i<document.listView.elements.length; i++) {
			if (document.listView.elements[i].type == "checkbox") {
				document.listView.elements[i].checked = false;
			}
		}
		document.getElementById("selectCount").innerHTML = 0;
		if (document.getElementById("selectCount1"))	document.getElementById("selectCount1").innerHTML = 0;
	}
}	

// Function to generate the selected Checkbox's Count	
function select_count()
{
	var a = 0;
	
	for (i=0; i<document.listView.elements.length; i++) {
		if (document.listView.elements[i].type == "checkbox") {
			if (document.listView.elements[i].checked == true)
				a = a + 1;
		}			
	}				

	document.getElementById("selectCount").innerHTML = a;
	if (document.getElementById("selectCount1"))	document.getElementById("selectCount1").innerHTML = a;
	
	if (document.listView.checkAll.checked == true)	{
		document.getElementById("selectCount").innerHTML = a-1;
		if (document.getElementById("selectCount1"))	document.getElementById("selectCount1").innerHTML = a-1;
	}
	document.listView.checkAll.checked = false;			
}

// Function to Clear all the Checkbox selected
function clearfunc()
{	  
	for (i=0; i<document.listView.elements.length; i++) {
		if (document.listView.elements[i].type == "checkbox") {
			document.listView.elements[i].checked = false;
		}
	}
	document.getElementById("selectCount").innerHTML = 0;
	if (document.getElementById("selectCount1"))	document.getElementById("selectCount1").innerHTML = 0;
}

// Function to confirm before delete
function isDeleteValid()
{
	var msg1 = "Are you sure to delete? ";
	
	var x = window.confirm(msg1);
	
	if (x)
		isValid = true;
	else
		isValid=false;
		
	return isValid;
}

// Function to validate the form before delete operation executes
function formValidator()
{
	var a=0;
	for(i=0; i<document.listView.elements.length; i++)
	{
		if(document.listView.elements[i].type=="checkbox"  && document.listView.elements[i].name != "checkAll")
		 {			    
			if (document.listView.elements[i].checked == true)
			a = a + 1;
		 }			
	}				

	if (a < 1) {
		alert("Select atleast one record to delete");
		return false;
	}
	else
	{		  
			if (document.listView.checkAll.checked == true) {
				//var z = window.confirm("Are you sure to delete "+(a-1)+" record(s) ?");	
				var z = window.confirm("Are you sure to delete "+a+" record(s) ?");	
			} else {
				var z = window.confirm("Are you sure to delete "+a+" record(s) ?");	
			}
    
			if (z) {
				return true;
			} else {
		  		//	   alert("Select atleast one record to delete");
			  	return false;
			}
	}
	return true;
}		

// Function to validate the form before delete operation executes
function chkCompare(cmpUrl)
{
	var cmp = 0;
	var cmpIds = "";
	for(chkCnt = 0; chkCnt < document.listView.elements.length; chkCnt++)
	{
		if(document.listView.elements[chkCnt].type=="checkbox"  && document.listView.elements[chkCnt].name != "checkAll")
		 {			    
			if (document.listView.elements[chkCnt].checked == true) {
				cmp = cmp + 1;
				cmpIds += document.listView.elements[chkCnt].value+',';
			}
		 }			
	}				

	if (cmp < 2) {
		alert("Select atleast two product to compare");
		return false;
	} else if (cmp > 5) {
		alert("Not more than five products can be compared at a time");
		return false;
		
	} else {
		cmpPath = cmpUrl+'?cmpId='+cmpIds;
		window.open(cmpPath, "mzHelpWindowName", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, top=100, left=50, width=900, height=500");
	}
	return true;
}		

// Function to rotate the images existed in an array
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_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_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];}
}
	              
// Comma separated list of images to rotate
// delay in milliseconds between image swaps 1000 = 1 second
var delay = 5000;
var counter = 0;

function preloadImgs(){
  for(var i=0;i<imgs.length;i++){
  	if (imgs[i] != "") 
      MM_preloadImages(imgs[i]);
  }
}

function randomImages(){
  if(counter == (imgs.length)){
    counter = 0;
  }
  MM_swapImage('bundledImage', '', imgs[counter++]);
  setTimeout('randomImages()', delay);
}


