// Alhamdullilah By Muhammadsukree


//--------------------------------------------------------------------------------------------------------------------------------------------------
// Open a new windows
//function  krwin(page,pname,toolbar,location,resizable,status,scrollbars,width,height,top,left){
function  krwin(page,width,height,top,left,resizable,scrollbars,toolbar,location,status,pname){	
	pname=(pname)?pname:"";
	toolbar=(toolbar)?toolbar:0;
	location=(location)?location:0;
	resizable=(resizable)?resizable:0;
	status=(status)?status:0;
	scrollbars=(scrollbars)?scrollbars:0;
	width=(width)?width:0;
	height=(height)?height:0;
	top=(top)?top:0;
	top=(top)?top:0;
	krw=window.open(page,
										pname,
										'toolbar='+toolbar+',location='+location+',resizable='+resizable+',status='+status+',scrollbars='+scrollbars+',width='+width+',height='+height+',top='+top+',left='+left+'');
	if (krw.opener == null) krw.opener = self;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
function MessagesInsert(wantpage,user){
	wantpage=(wantpage)?wantpage:"index.php";	
	user=(user)?user:"";
	var vmessages=messages.value;	
	
	if(vmessages=="" || vmessages=="   กรุณา login ครั้งแรก จากนั้นส่งข้อความได้ไม่จำกัดค่ะ"){alert("กรุณากรอกข้อมูลด้วย");messages.focus();return false;}
	
	if(user==""){
			messages.value="";
			var page=curwwwroot+"/modules/user/index.php";
			//alert("กรุณาสมัครชิกก่อน ");
			/*
			var t=confirm("กรุณา Login ก่อน \nคุณเป็นสมาชิกของ 94FMClub แล้วหรือไม่ ?");
			if(t){
				// Login	
				krwin(page+'/?mode=loginform',300,150,200,220);	
			}else{
				// Register
				krwin(page,400,300,100,120);
			}
			*/
			krwin(page+'/?mode=loginform',310,370,200,220,0);	
			return false;
	} // end if
	
	messages.value="";
	para="mmessages=messages_insert"+"&messages="+vmessages;
	requestResult('dr_messages',wantpage,para,'Please wait ... ',1);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
// สำหรับกำหนดให้คลิกครั้งเดียว
// แล้วเคลียร์
// หลังจากนั้น ก็ไม่ต้องทำอะไร แล้ว
var smsclick=0;
function smsClearBox(){
	if(smsclick==0)	{
		messages.value="";		
	}
	smsclick=1;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
