function Initialize() {
   el = document.getElementById('ValentineToy');
   if(el.style.visibility == 'visible'){
      el.style.visibility = 'hidden';
   }else{
      el.style.visibility = 'visible';
      Xmen=document.body.scrollLeft+window.event.clientX-60;
      Ymen=document.body.scrollTop+window.event.clientY-130;
      el.style.left=Xmen +'px';
      el.style.top=Ymen +'px';
   }
}
function storeCaret (textEl){
   if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
function InsertToy(text){
   document.FollowForm.message.focus();
   text='//'+text;
   textEl= document.FollowForm.message;
   if (textEl.createTextRange && textEl.caretPos){
      var caretPos = textEl.caretPos;
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
   }else{
      textEl.value = text;
   }
   document.FollowForm.message.focus();
}
function PantipP2M(img){
	//popup_photo2mobile('1400', "http://www.pantip.com"+img);
}
function popup_photo2mobile(partner_id,fullurl) {
	//var pmWin = window.open('http://www.monozone.com/p2mcolor.php?pid=' + partner_id +'&img='+escape(fullurl),'p2m','status=0,menuBar=0,statusbar=0,resizable=0,scrollBars=0,HEIGHT=450,WIDTH=550,top=50,left=50');
}
function pChecker(kname){
   kname=kname+"=";
   var alen=kname.length;
   var cklen=document.cookie.length;
   var start=document.cookie.indexOf (kname, 0);
   var end=document.cookie.indexOf (';', start);
   if (start==-1)
      return '';
   if (end==-1)
      return unescape(document.cookie.substring(start+alen, cklen));
   return unescape(document.cookie.substring(start+alen, end));
}
function ShowEmotion(){
	str="";
	if (pChecker("ckPantipMember")){
		for(i=1; i<=20; i++){
		   str +="<img src=\"/cafe/image/emoicon"+i+".gif\" onclick=\"chIcon("+i+");\"> &nbsp; ";
		   if (i==10)
			  str+="<br>";
		}
		document.getElementById("selectEmo").innerHTML="<br>"+str+"<br>";
	}else{
		alert("กรุณา Login สมาชิกก่อนครับ");
	}
}
function chIcon(ico){
   document.getElementById("icon_member").src="/cafe/image/emoicon"+ico+".gif";
   document.getElementById("selectEmo").innerHTML="";
   document.FollowForm.Emoicon.value=ico;
}
function PosterType(type) {
   if (type=="file"){
      document.getElementById("attf1").innerHTML="<a href=\"/cafe/help.html#file_attach\" target=\"_blank\"><font color=\"#FFFFFF\">ไฟล์ประกอบ</a> :</font>";
      document.getElementById("attf2").innerHTML="<input type=\"file\" name=\"file_attach\" accept=\"*/*\"> (ไม่เกิน 150 K / Member เท่านั้น / Preview ไม่ได้) <br>(gif, jpg, png, mid, wav, mp3, wma, swf)";
   }else if (type=="youtube"){
      document.getElementById("attf1").innerHTML="<a href=\"/cafe/help.html#url_video\" target=\"_blank\"><font color=\"#FFFFFF\">คลิปวิดีโอ</a> : </font>";
      document.getElementById("attf2").innerHTML="<input type=\"text\" name=\"youtube\" size=50> (Member เท่านั้น)<br>ใส่ URL ของไฟล์ youtube (soapbox ใช้ไม่ได้แล้ว)";
   }
}
function PopupDraw(group, subgroup, id){
  document.getElementById("attf1").innerHTML="วาดภาพประกอบ : ";
  document.getElementById("attf2").innerHTML="<a href=\"http://www.pantip.com/cafe/php/draw/draw_post_form.php?ID="+id+"&group="+group+"&subgroup="+subgroup+"&action=follow\">คลิกเพื่อวาดภาพประกอบ</a><br>(ข้อควรระวัง : ต้องทำก่อนขั้นตอนอื่น มิฉะนั้นข้อความที่พิมพ์ไว้ และค่าที่เลือกจะหายไป - ใช้ได้เฉพาะสมาชิก)";
}
