function ShowHideLayer(divID) {
	var box = document.getElementById(divID);	
		
	if(box.style.display == "none" || box.style.display=="") {
		box.style.display = "block"; 		
	}
	else {
		box.style.display = "none";		
	}
}

function createCookie(name,value,days) {
 if (days) {
  var date = new Date();
  date.setTime(date.getTime()+(days*24*60*60*1000));
  var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
}

function eraseCookie(name) {
 createCookie(name,"",-1);
}


function ConfirmChoice(strurl,strmsg){
	answer = confirm(strmsg);

	if (answer !=0){
			//alert('hi'+recid);
			window.location.href=strurl;
		}
	}
function ConfirmChoice2(recid){
	answer = confirm("คุณต้องการปรับปรุงสถานะจริงหรือไม่ ??")

	if (answer !=0){
			//alert('hi'+recid);
			window.location.href='?option=<?=$option?>&mod=<?=$mod?>&cmd=<?=$mod?>_listing&action=<?=$mod?>_status_change&recid='+recid;
		}
	}
function ConfirmChoice3(recid){
	answer = confirm("คุณต้องการเผยแพร่จริงหรือไม่ ??")

	if (answer !=0){
			//alert('hi'+recid);
			window.location.href='?option=<?=$option?>&mod=<?=$mod?>&cmd=<?=$mod?>_listing&action=<?=$mod?>_publish_change&recid='+recid;
		}
	}

function openWindow(page,width,height) {
	var windowprops = "width="+width+",height="+height+",width=650,height=500,left=0,top=100,screenX=0,screenY=100,scrollbars=yes,menubar=yes";
		newWindow = window.open(page,'PopupName',windowprops);
		//return true;
}					
