var panel;

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
		 {
		 myfield.form.submit();
		 return false;
		 }
	else
		 return true;
}


function checkUncheckAll(el)
{
	var chkBoxForm = el.form, z = 0;
	for(z=0; z<chkBoxForm.length;z++) {
    	if(chkBoxForm[z].type == 'checkbox'  && chkBoxForm[z].name != 'checkall') {
			chkBoxForm[z].checked = el.checked;
	  	}
	}
	
/*	var chkBox = document.getElementsByName(chkBoxName);
	alert(chkBox);
	var chkBoxCount = chkBox.length;
	alert(chkBoxCount);
	if (!chkBoxCount) {
		alert("here");
		chkBox.checked = checkVal;
	} else {
		for(var i = 0; i < chkBoxCount; i++) { 
			chkBox[i].checked = checkVal;
		}
	}*/
}


function toggle_visibility(id) {
   var e = document.getElementById(id);
	if(e.style.display == 'block')
	  e.style.display = 'none';
   else
	  e.style.display = 'block';
}

function toggle_filterIcons() {
	var moreEl = document.getElementById('filter_more');
	var lessEl = document.getElementById('filter_less');
	if (moreEl.style.display == 'inline') {
		moreEl.style.display = 'none';
		lessEl.style.display = 'inline';
	} else {
		moreEl.style.display = 'inline';
		lessEl.style.display = 'none';		
	}		
}

function startGetShopDetails(shopId) {
	url = "ajax/getShopDetails.php?shopId=" + escape(shopId);
	if (window.XMLHttpRequest) { // Non-IE browsers
		req = new XMLHttpRequest();
		req.onreadystatechange = processGetShopDetails;
		try {
			req.open("GET", url, true);
			document.body.style.cursor="wait";
		} catch (e) {
			alert(e);
		}
		req.send(null);
	} else if (window.ActiveXObject) { // IE
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processGetShopDetails;
			req.open("GET", url, true);
			req.send();
			document.body.style.cursor="wait";
		}
	}
}
function processGetShopDetails() {
	if (req.readyState == 4) { // Complete
		document.body.style.cursor="auto";
		if (req.status == 200) { // OK response
			Tip('<div class="retailer">'+req.responseText+'</div>', 
				WIDTH, 300, 
				TITLE, 'Shop Info', 
				TITLEFONTCOLOR, '#FCDBD3',
				TITLEPADDING, 5,
				BORDERCOLOR, '#2D1C51', 
				BORDERWIDTH, 2,
				BGCOLOR, '#FCDBD3',
				SHADOW, true, 
				SHADOWWIDTH, 3,
				SHADOWCOLOR, '#9C88C8',
				FADEIN, 300, 
				FADEOUT, 300,
				STICKY, 1,
				CLOSEBTN, true, 
				CLICKCLOSE, true, 
				CLOSEBTNCOLORS, ['#9C88C8', '#FCDBD3', '#FCDBD3', '#9C88C8']);
		} else {
			alert("Problem: " + req.statusText);      
		}
	}
}			

 	function createPanel(parentNode) {

	 panel = new YAHOO.widget.Panel("panel", { 

	    width:"400px",  

	    fixedcenter: true,  

	    constraintoviewport: true,  

	    underlay:"shadow", 

	    close:true,  

	    visible:false,  

	    draggable:true,

			modal:true,

			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.30}

			} ); 
	 	panel.setBody("");

		panel.render(parentNode);

		return panel;

	}
