/****************************************
 ** FOR TOP ARTICLE MENU -- ICON --
 ***************************************/
function setEmailSender(cookie1, cookie2, to1, to2) {
        if (readCookie(cookie1) != null)
        {
                var senderFriend = document.getElementById(to1);
                if (senderFriend) senderFriend.value = readCookie(cookie1);
        }
        if (readCookie(cookie2) != null)
        {
                var emailFriend = document.getElementById(to2);
                if (emailFriend) emailFriend.value = readCookie(cookie2);
        }
}

function createCookie2(name,value,minute)
{
	if (minute)
	{
		var date = new Date();
		date.setTime(date.getTime()+(minute*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/; domain=kapanlagi.com";
}

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;
}


/*    END COPY PASTE     */

function getDataService2(go, action, id, id2, b) 
{
	processLoading(id);
	
	try
	{
		http.open('post', go);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.send(action);

		http.onreadystatechange = function () {
			if(http.readyState == 4) 
			{
				var response = http.responseText;

				if (http.status == 200) 
				{
                                    var sp = response.split('||');
                                
                                    document.getElementById(id).innerHTML = sp[1];
                                    if (sp[0] == 'OK')
                                    {
                                        clearForm(id2);
                                        b.disabled = true;
                                    }
                                }
				else 
				{
					alert("ERROR:" + http.status + " Ada masalah pada pengiriman data!");
				}
			}
		}
	}
	catch (e){}
	finally {}
}

function clearForm(tab) {
      var d = document.getElementById(tab);
      if (d)
      {
          for (i = 0; i < d.length; i++)
          {
              if ((d[i].type == "text") || d[i].type == "textarea")
              {
                  d[i].value = '';
              }
              
              if (d[i].type == "checkbox")
              {
                  d[i].checked = false;
              }
          }
      }
}

 /*
    show message with red color
 */
 function boxError(id, msg) {
      document.getElementById(id).innerHTML = '<div style="background:#FF0000; color: #FFFFFF; padding:2px;">'+ msg +'</div>';
 }
 
 /*
    Show process info
 */
 function processLoading(id) {
	boxError(id, 'Sedang Proses...');
 }
 
 /*
    Clear all message status
 */
 function clearAllMessage() {
        var stf = document.getElementById('sendToFriend');
        var cn = document.getElementById('commentNews');
        var c = document.getElementById('comment');
        var rnli = document.getElementById('registerNewsLetterInfo');
        
        if (stf) stf.innerHTML = '';
        if (cn) cn.innerHTML = '';
        if (c) c.innerHTML = '';
        if (rnli) rnli.innerHTML = '';

        var stft = document.getElementById('sendToFriendTop');
        var cnt = document.getElementById('commentNewsTop');
        var ct = document.getElementById('commentTop');
        var rnlit = document.getElementById('registerNewsLetterInfoTop');
        
        if (stft) stft.innerHTML = '';
        if (cnt) cnt.innerHTML = '';
        if (ct) ct.innerHTML = '';
        if (rnlit) rnlit.innerHTML = '';

 }
 
function switchNewsTabTop(active) {
    
    var eleActive = document.getElementById(active);
    var valNow = eleActive.style.display;

    var f1 = document.getElementById('newsTopInfoEmail');
    var f2 = document.getElementById('newsTopInfoComment');
    var f3 = document.getElementById('newsTopInfoFans');
    var f4 = document.getElementById('newsTopInfoDaftar');

    checkMemberLoginTop();
    
    if (f1) f1.style.display = "none";
    if (f2) f2.style.display = "none";
    if (f3) f3.style.display = "none";
    if (f4) f4.style.display = "none";
    
    clearAllMessage();
   
   var cssObj1 = {
     "margin-top":"10px",
     "background-color":"#fff",
     "border":"2px solid #999",
     "position":"absolute",
     "z-index":"10"
   }
    
    
    if (valNow == "inline")
    {
        eleActive.style.display = "none";
    }
    else
    {
        eleActive.style.display = "inline";
        $('#'+active+'').css(cssObj1);
    }
    
    /*
        first for send to friend
        second for newsletter KapanLagi
        third for news comment
        fourth for fans comment
    setEmailSender('cSenderTmp', 'cEmailTmp', 'nameFriendTop', 'emailFriendTop');
    for (var i = 1; i <= 5; i++) setEmailSender('cDestNameTmp'+ i, 'cDestEmailTmp'+ i, 'recipientTop'+ i, 'remTop'+ i);
    
    setEmailSender('cSenderTmp', 'cEmailTmp', 'nameNewsletterTop', 'emailNewsletterTop');
    setEmailSender('cSenderTmp', 'cEmailTmp', 'commentNamaTop', 'commentEmailTop');
    setEmailSender('cSenderTmp', 'cEmailTmp', 'namaFansTop', 'emailFansTop');
    */
}

 function checkMemberLoginTop() {
    
    var member_email = readCookie("mbremface");
    var member_name = '';
 
    if (member_email != null)
    {
          member_email = decodeURIComponent(member_email);
 
          if (readCookie('mbrnmface') != null)
          {
                member_name = readCookie("mbrnmface");					
          }
 
          if (member_name == "" || member_name == null) 
          {
                member_name = member_email;
          }

          /* set name sender to cookie, set it to 30 minutes*/
          //createCookie2('cSenderTmp', member_name, 30);

          if (document.getElementById("newsTopInfoEmail"))
          {
                document.getElementById('topBoxSendToFriend').style.display = "none";
          }
          if (document.getElementById("newsTopInfoFans"))
          {
                document.getElementById('topBoxCelebFans').style.display = "none";
          }
          if (document.getElementById("newsTopInfoDaftar"))
          {
                document.getElementById('topBoxNewLetter').style.display = "none";
          }
          if (document.getElementById("newsTopInfoComment"))
          {
                document.getElementById('topBoxNewsComment').style.display = "none";
          }
    }
 }

 
 function sendToFriendDataTop(button) {
  
      var name = document.getElementById('nameFriendTop');
      var email = document.getElementById('emailFriendTop');
      var type = document.getElementById('typeTop').value;
      //var url = document.getElementById('urlTop').value;
      var flag = document.getElementById('flagTop').value;
      var allow = false;
      var allow2 = false;
      var copy = 0;
      if (document.getElementById('idcopyTop').checked)
      {
            copy = 1;
      }
      
      var variable = 'action=send_to_friend&name='+ name.value +'&email='+ email.value +'&type='+ type +'&url='+ article_url +'&flag='+ flag +'&copy='+ copy;
      for (i = 1; i <= 5; i++)
      {
          var x = document.getElementById('recipientTop'+ i).value;
          variable += '&recipient'+ i +'='+ x;
          
          if (x != '')
          {
             // createCookie2('cDestNameTmp'+ i, x, 30);
              allow = true;
          }
      }
      for (i = 1; i <= 5; i++)
      {
          var y = document.getElementById('remTop'+ i).value;
          variable += '&rem'+ i +'='+ y;

          if (y != '')
          {
             // createCookie2('cDestEmailTmp'+ i, y, 30);
              allow2 = true;
          }
      }
      
      if ((! allow) || (! allow2))
      {
          boxError('sendToFriendTop', 'Nama dan Email tujuan tidak boleh kosong.');
          return false;
      }
    
    getDataService2('/u/news_service.php', variable, 'sendToFriendTop', 'newsTopInfoEmailForm', button);
    
    return true;
 }
 
  function newsCommentTop(button) {
    var words = document.getElementById('pesanNewsCommentTop').value;
    var splitWords = words.split(' ');
    var ssender = document.getElementById('commentNamaTop');
    var semail = document.getElementById('commentEmailTop');
    if(splitWords.length < 10 || words.length > 1000)
    {
        boxError('commentNewsTop', 'Komentar tidak boleh kurang dari 10 kata.')
    }
    else
    {
        var nama_var = "";
        if (ssender) {
                nama_var = ssender.value;
        }
        var email_var = "";
        if (ssender) {
                email_var = semail.value;
        }
        var id_var = document.getElementById('commentIdNewsTop').value;
        var title_var = document.getElementById('commentTitleNewsTop').value;
        var pesan_var = document.getElementById('pesanNewsCommentTop').value
        
        getDataService2('/u/news_service.php','action=news_comment&nama='+ nama_var +'&email='+ email_var +'&id='+ id_var +'&title='+ encodeURIComponent(title_var) +'&pesan='+ encodeURIComponent(pesan_var), 'commentNewsTop', 'newsTopInfoCommentForm', button);
    }    
}

function registerNewsLetterDataTop(button) {
  
      var name = document.getElementById('nameNewsletterTop');
      var email = document.getElementById('emailNewsletterTop');
      var allow = false;
      
      if (name && name.value == '' && (readCookie("mbremface") == null || readCookie("mbremface") == ""))
      {
          boxError('registerNewsLetterInfoTop', 'Nama tidak boleh kosong.');
          return false;
      }
      
      var mbrnm = readCookie("mbrnmface");
      if (mbrnm == "" || mbrnm == null) {
        mbrnm = name.value;
      }
      
      if (mbrnm != "") {
        /* set name sender to cookie, set it to 30 minutes*/
        createCookie2('cSenderTmp', mbrnm, 30);
      }

      if (email && email.value == '' && (readCookie("mbremface") == null || readCookie("mbremface") == ""))
      {
          boxError('registerNewsLetterInfoTop', 'Email tidak boleh kosong.');
          return false;
      }
      if (email && email.value != "") {
        /* set name sender to cookie, set it to 30 minutes*/
        createCookie2('cEmailTmp', email.value, 30);
      }
      
      var variable = 'action=register_newsletter&name='+ mbrnm +'&email='+ email.value;
      for (i = 1; i <= 18; i++)
      {
          var x = document.getElementById('checkboxTop'+ i)
          if (x.checked)
             variable += '&checkbox'+ i +'='+ x.value;
          else
             variable += '&checkbox'+ i +'=';
          
          if (x.checked)
              allow = true;
      }
      
      if (! allow)
      {
          boxError('registerNewsLetterInfoTop', 'Pilih minimal satu kategori berita.');
          return false;
      }
      
    getDataService2('/u/news_service.php', variable, 'registerNewsLetterInfoTop', 'newsTopInfoDaftarForm', button);

    return true;
 }
 
 function newsFansCommentTop(button) {
    var words = document.getElementById('pesanTop').value;
    var splitWords = words.split(' ');
    var ssender = document.getElementById('namaFansTop');
    var semail = document.getElementById('emailFansTop');
    if(splitWords.length < 10 || words.length > 1000)
    {
        boxError('commentTop', 'Pesan tidak boleh kurang dari 10 kata.')
    }
    else
    {
        var nama_var = ""
        if (ssender) nama_var = ssender.value;
        var email_var = "";
        if (semail) email_var = semail.value;
        var artis_var =  document.getElementById('newsArtistTop').value;
        var pesan_var = document.getElementById('pesanTop').value;
        
        getDataService2('/u/news_service.php','a=1&action=selebriti_comment&status=0&nama='+ nama_var +'&email='+ email_var +'&artis='+ artis_var +'&pesan='+ pesan_var, 'commentTop', 'newsBottomInfoFansFormTop', button);
        
    }
}

var RightMenu = '';
if(wide == 'true'){
   RightMenu = '<div style="margin:0px 0px 4px 0px;text-align:center;">';
   RightMenu += '        <a class="rightLink" alt="Cetak Berita" title="Cetak Berita" href="'+ print_url +'" target="_BLANK"><b>CETAK ARTIKEL INI</b></a> <span class="wideRightCon">|</span> ';
   RightMenu += '        <a class="rightLink" alt="Daftar Mailing List" title="Daftar Mailing List" href="#titleArticle" onclick="javascript: switchNewsTabTop(\'newsTopInfoDaftar\');"><b>DAFTAR NEWSLETTER</b></a> <span class="wideRightCon">|</span> ';
   RightMenu += '        <a class="rightLink" alt="Kirim Email ke Teman" title="Kirim Email ke Teman" href="#titleArticle" onclick="javascript: switchNewsTabTop(\'newsTopInfoEmail\');"><b>KIRIM KE TEMAN</b></a><br />';
   RightMenu += '        <a class="rightLink" alt="Diskusikan di Milis" title="Diskusikan di Milis" href="http://www.kapanlagi.com/u/newsthick.php?x=wo&sb=m&amp;id='+ article_id +'&amp;type=wo" onclick="return show_hide_centered_box(this, 680, 450, 5);"><b>DISKUSIKAN DI MILIS</b></a>  <span class="wideRightCon">|</span> ';
   RightMenu += '        <a class="rightLink" alt="Diskusikan di Milis" title="Diskusikan di Milis" href="http://www.kapanlagi.com/u/newsthick.php?x=wo&sb=wa&amp;id='+ article_id +'&amp;type=wo&amp;t='+ article_title +'&amp;url='+ article_url +'" onclick="return show_hide_centered_box(this, 680, 450, 1);"><b>KOMENTAR ANDA</b></a>';
}else{
   RightMenu = '<div style="margin-top:4px;">';
   RightMenu += '        <a class="rightLink" alt="Cetak Berita" title="Cetak Berita" href="'+ print_url +'" target="_BLANK"><b>CETAK ARTIKEL INI</b></a>';
   RightMenu += '    <hr color="#cecece" size="1">';
   RightMenu += '        <a class="rightLink" alt="Daftar Mailing List" title="Daftar Mailing List" href="#titleArticle" onclick="javascript: switchNewsTabTop(\'newsTopInfoDaftar\');"><b>DAFTAR NEWSLETTER</b></a>';
   RightMenu += '    <hr color="#cecece" size="1">';
   RightMenu += '        <a class="rightLink" alt="Kirim Email ke Teman" title="Kirim Email ke Teman" href="#titleArticle" onclick="javascript: switchNewsTabTop(\'newsTopInfoEmail\');"><b>KIRIM KE TEMAN</b></a>';
   RightMenu += '    <hr color="#cecece" size="1">';
   RightMenu += '        <a class="rightLink" alt="Diskusikan di Milis" title="Diskusikan di Milis" href="http://www.kapanlagi.com/u/newsthick.php?x=wo&sb=m&amp;id='+ article_id +'&amp;type=wo" onclick="return show_hide_centered_box(this, 680, 450, 5);"><b>DISKUSIKAN DI MILIS</b></a>';
   RightMenu += '    <hr color="#cecece" size="1">';
   RightMenu += '        <a class="rightLink" alt="Komentar Anda" title="Komentar Anda" href="http://www.kapanlagi.com/u/newsthick.php?x=wo&sb=wa&amp;id='+ article_id +'&amp;type=wo&amp;t='+ article_title +'&amp;url='+ article_url +'" onclick="return show_hide_centered_box(this, 680, 450, 1);"><b>KOMENTAR ANDA</b></a>';
}

if (have_artist=='true')
{
   RightMenu += '    <hr style="color:#eee;" size="1">';
   var artisUp = artist_name.toUpperCase();
   RightMenu += '    <a  alt="Kirim Komentar Ke Fans" title="Kirim Komentar Ke '+ artist_name +'" href="#titleArticle" onclick="javascript: switchNewsTabTop(\'newsTopInfoFans\');"><b>KOMENTAR FANS '+artisUp+'</b></a>';
}

RightMenu = '' + RightMenu + '</div>';

var TopMenu = '<div style="clear: both; padding: 1px 3px 10px 5px; text-align: left;">';

TopMenu += '<div style="clear: both;"></div>';
TopMenu += '	<div style="float: left; display: none; border: 1px solid #666666;" id="newsTopInfoEmail">';
TopMenu += '	  <div style="padding: 0px; width: 330px;">';
TopMenu += '	    <div style="padding: 10px; font-weight:bold;text-align:center; background-color: #ededed;color:#333;">KIRIM EMAIL KE TEMAN</div>';
TopMenu += '	    <div style="padding: 10px;">Informasikan ke teman-teman Anda mengenai berita di bawah melalui email.</div>';
TopMenu += '	    <div style="padding: 8px;">';
TopMenu += '	      <form action="/u/sendtofriend.php" method="post" target="subscribe" onSubmit="return false;" id="newsTopmInfoEmailForm">';
TopMenu += '            <div id="topBoxSendToFriend">';
TopMenu += '	        <div style="float:left; margin:2px">Nama Anda</div>';
TopMenu += '	        <div style="float:right;text-align:right; margin:2px;" id="nameFriendTopPar"><input style="width:150px" type="text" name="name" id="nameFriendTop" value=""></div>';
TopMenu += '	        <div style="clear: both; width: 120px; float:left; margin:2px">Alamat Email Anda</div>';
TopMenu += '	        <div style="float:right;text-align:right; margin:2px;" id="emailFriendTopPar"><input style="width:150px" type="text" name="email" id="emailFriendTop" value=""></div>';
TopMenu += '	        <div style="clear: both;"></div>';
TopMenu += '	        <br /></div>';
TopMenu += '	        <div style="clear: both; text-align:center; margin: 3px;font-weight:bold;">Kirim Ke</div>';
TopMenu += '	        <div style="float:left; padding-left: 10px;">Nama</div>';
TopMenu += '	        <div style="float:right;text-align:right; padding-right: 10px;">Email</div>';
TopMenu += '	        <br style="clear: both;" />';
TopMenu += '                <div style="float:left;margin:1px;"><input style="width:135px" type="text" name="recipientTop1" id="recipientTop1" value=""></div><div style="float:right;margin:1px;text-align:right;"><input style="width:140px" type="text" name="remTop1" id="remTop1" value=""></div><div style="float:left;margin:1px;"><input style="width:135px" type="text" name="recipientTop2" id="recipientTop2" value=""></div><div style="float:right;margin:1px;text-align:right;"><input style="width:140px" type="text" name="remTop2" id="remTop2" value=""></div><div style="float:left;margin:1px;"><input style="width:135px" type="text" name="recipientTop3" id="recipientTop3" value=""></div><div style="float:right;margin:1px;text-align:right;"><input style="width:140px" type="text" name="remTop3" id="remTop3" value=""></div><div style="float:left;margin:1px;"><input style="width:135px" type="text" name="recipientTop4" id="recipientTop4" value=""></div><div style="float:right;margin:1px;text-align:right;"><input style="width:140px" type="text" name="remTop4" id="remTop4" value=""></div><div style="float:left;margin:1px;"><input style="width:135px" type="text" name="recipientTop5" id="recipientTop5" value=""></div><div style="float:right;margin:1px;text-align:right;"><input style="width:140px" type="text" name="remTop5" id="remTop5" value=""></div>';
TopMenu += '	        <br style="clear:both;" />';
TopMenu += '	        <br />';
TopMenu += '                <div id="sendToFriendTop"></div>';
TopMenu += '	        <div style="float:left; padding-top: 5px;">';
TopMenu += '	          <div style="float:left;text-align:left; width:260px;">';
TopMenu += '                        <input type="checkbox" name="copyTop" id="idcopyTop" value=1 checked /> kirim copy ke email saya';
TopMenu += '                  </div>';
TopMenu += '                  <br style="clear: both;" />';
TopMenu += '	        </div>';
TopMenu += '                <div style="clear: both;"></div>';
TopMenu += '                <div style="width: 100%; padding-top: 10px; text-align: right;">';
TopMenu += '                             <input type=hidden name="typeTop" id="typeTop" value="news">';
//TopMenu += '                             <input type=hidden name="urlTop" id="urlTop" value="'+ article_url +'">';
TopMenu += '                             <input type=hidden name="flagTop" id="flagTop" value="true">';
TopMenu += '                             <input class="button" type="button" value="Tutup form ini" onclick="javascript: document.getElementById(\'newsTopInfoEmail\').style.display = \'none\';" />';
TopMenu += '                             <input class="button" value="Kirim"  onclick="javascript: sendToFriendDataTop(this);" type="submit" />';
TopMenu += '                       </div>';
TopMenu += '	        <br style="clear:both;" />';
TopMenu += '	      </form>';
TopMenu += '	    </div>';
TopMenu += '	  </div>';
TopMenu += '	</div>';
TopMenu += '	<div style="float: left; display: none; border: 1px solid #666666;" id="newsTopInfoComment">';
TopMenu += '                    <form id="newsTopInfoCommentForm">';
TopMenu += '	  <div style="padding: 0px; width: 330px;" id="mainCommentNewsTop">';
TopMenu += '	    <div style="padding: 10px; font-weight:bold;text-align:center; background-color: #ededed;">KOMENTAR PEMBACA</div>';
TopMenu += '	    <div style="padding: 10px;">';
TopMenu += '	      Berikan komentar Anda untuk berita di bawah.<br />';
TopMenu += '	      Komentar akan ditampilkan di halaman ini, diharapkan sopan dan bertanggung jawab.';
TopMenu += '	    </div>';
TopMenu += '        <div style="padding: 8px;">';
TopMenu += '        <div id="topBoxNewsComment">';
TopMenu += '                       <div style="clear: both; text-align: left; padding-top: 8px;">';
TopMenu += '	    	    <div style="float: left; width: 75px;">Nama Anda</div>';
TopMenu += '	            <div style="float: left;" id="commentLine2">:&nbsp;</div>';
TopMenu += '	    	    <div id="commentLineName" style="float: left;"><input style="width: 210px ! important;" name="namaNewsCommentTop" id="commentNamaTop" type="text"></div>';
TopMenu += '	        </div>';
TopMenu += '	        <div id="commentLineEmailPar" style="clear: both; text-align: left; padding-top: 1px;">';
TopMenu += '	    	    <div style="float: left; width: 75px;">Email Anda</div>';
TopMenu += '	    	    <div style="float: left;" id="commentLine1">:&nbsp;</div>';
TopMenu += '	    	    <div id="commentLineEmail" style="float: left;"><input style="width: 210px ! important;" name="emailNewsCommentTop" id="commentEmailTop" type="text"></div>';
TopMenu += '	        </div>';
TopMenu += '        </div>';
TopMenu += '	        <div style="clear: both; padding-top: 1px;" id="lineMessage">';
TopMenu += '	  		<div style="float: left; width: 75px;">Komentar</div>';
TopMenu += '	  		<div style="float: left;">:&nbsp;</div>';
TopMenu += '	  		<div style="float: left;"><textarea style="width:210px;" rows="5" name="pesanNewsCommentTop" id="pesanNewsCommentTop"></textarea></div>';
TopMenu += '	  	</div>';
TopMenu += '	  	<div style="clear: both;"></div>';
TopMenu += '	  	<div style="padding: 5px 0px 0px 90px; clear: both;">';
TopMenu += '	  		<span style="font-size: 11px;">KapanLagi.com berhak menghapus komentar yang tidak layak ditampilkan</span><br><br>';
TopMenu += '	  	</div>';
TopMenu += '                       <div id="commentNewsTop"></div>';
TopMenu += '                       <div style="padding-top: 5px; text-align: right;">';
TopMenu += '                           <input type="hidden" name="commentIdNewsTop" id="commentIdNewsTop" value="'+ article_id +'" />';
TopMenu += '                           <input type="hidden" name="commentTitleNewsTop" id="commentTitleNewsTop" value="'+ article_title +'" />';
TopMenu += '                           <input type="button" class="button" value="Tutup form ini" onclick="javascript: document.getElementById(\'newsTopInfoComment\').style.display = \'none\';" />';
TopMenu += '                           <input name="submitNewsComment" value="   Kirim   " onclick="javascript: newsCommentTop(this);" type="button">';
TopMenu += '                       </div>';
TopMenu += '                    </div>';
TopMenu += '	 </div>';
TopMenu += '                   </form>';
TopMenu += '	</div>';

if (have_artist)
{
    TopMenu += '<div style="float: left; display: none; border: 1px solid #666666;" id="newsTopInfoFans">';
    TopMenu += '                   <form id="newsTopInfoFansForm">';
    TopMenu += '	  <div style="padding: 0px; width: 330px;" id="mainCommentTop">';
    TopMenu += '	    <div style="font-weight:bold; padding: 10px; text-align:center; background-color: #ededed;">KOMENTAR FANS '+ artist_name +'</div>';
    TopMenu += '	    <div style="padding: 10px;">';
    TopMenu += '	      Anda fans <a href="http://selebriti.kapanlagi.com/'+ artist_url +'"><b>'+ artist_name +'</b></a>? Berikan komentar Anda.';
    TopMenu += '	      Komentar akan ditampilkan di halaman biografi <a href="http://selebriti.kapanlagi.com/'+ artist_url +'"><b>'+ artist_name +'</b></a>, diharapkan sopan dan bertanggung jawab.';
    TopMenu += '	    </div>';
    TopMenu += '            <div style="padding: 8px;">';
    TopMenu += '            <div id="topBoxCelebFans">';
    TopMenu += '                   <div style="clear: both; text-align: left; padding-top: 8px;">';
    TopMenu += '                    <div style="float:left; width:75px;">Nama Anda</div>';
    TopMenu += '                    <div style="float:left;" id="line2">:&nbsp;</div>';
    TopMenu += '                    <div style="float:left;" id="lineName"><input style="width:210px !important; width:200px;" type="text" name="namaTop" id="namaFansTop" /></div>';
    TopMenu += '	           </div>';
    TopMenu += '	           <div id="fansCommentPar" style="clear: both; text-align: left; padding-top: 1px;">';
    TopMenu += '                    <div style="float:left; width:75px;">Email Anda</div>';
    TopMenu += '                    <div style="float:left;" id="line1">:&nbsp;</div>';
    TopMenu += '                    <div style="float:left;" id="lineEmail"><input style="width:210px !important; width:200px;" type="text" name="emailTop" id="emailFansTop" /></div>';
    TopMenu += '	           </div>';
    TopMenu += '	    </div>';
    TopMenu += '	    <div style="clear: both; padding-top: 1px;" id="lineMessage">';
    TopMenu += '	    	<div style="float: left; width: 75px;">Pesan</div>';
    TopMenu += '	    	<div style="float: left;">:&nbsp;</div>';
    TopMenu += '	    	<div style="float: left;"><textarea style="width:210px;" rows="5" name="pesanTop" id="pesanTop"></textarea></div>';
    TopMenu += '	    </div>';
    TopMenu += '	    <div style="clear: both;"></div>';
    TopMenu += '	    <div style="padding: 5px 0px 0px 90px; clear: both;">';
    TopMenu += '	    	<span style="font-size: 11px;">KapanLagi.com berhak menghapus komentar yang tidak layak ditampilkan</span><br /><br />';
    TopMenu += '	    </div>';
    TopMenu += '                   <div id="commentTop"></div>';
    TopMenu += '                   <div style="padding-top: 5px; text-align: right;">';
    TopMenu += '                       <input type="hidden" name="newsArtist" id="newsArtistTop" value="'+ artist_name +'" />';
    TopMenu += '                       <input type="button" class="button" value="Tutup form ini" onclick="javascript: document.getElementById(\'newsTopInfoFans\').style.display = \'none\';" />';
    TopMenu += '                       <input class="button" name="submitNewsCommentTop" value="   Kirim   " onclick="javascript: newsFansCommentTop(this);" type="button" />';
    TopMenu += '                   </div>';
    TopMenu += '                   </div>';
    TopMenu += '	  </div>';
    TopMenu += '                   </form>';
    TopMenu += '	</div>';
}

TopMenu += '           <div style="float: left; display: none; border: 1px solid #666666;" id="newsTopInfoDaftar">';
TopMenu += '	  <div style="padding: 0px; width: 330px;">';
TopMenu += '	  	<div style="padding: 10px; font-weight:bold;text-align:center; background-color: #ededed;color:#333;">NEWSLETTER KAPANLAGI.COM</div><br />';
TopMenu += '	    <div style="padding: 10px;">Dapatkan berita terbaru di email Anda setiap hari.</div><br />';
TopMenu += '	  	<div style="padding: 8px;">';
TopMenu += '	  		<form method="post" action="http://www.kapanlagi.com/u/savesubscribe.php" target="subscribe" id="newsTopInfoDaftarForm" onSubmit="return false;">';
TopMenu += '                        <div id="topBoxNewLetter">';
TopMenu += '	  			<div style="float: left; padding-left: 5px; padding-right: 3px;" id="newsLetterFullName">Nama:<br /><input style="width:140px" name="nameNewsletterTop" id="nameNewsletterTop" type="text"></div>';
TopMenu += '	  			<div style="padding-right: 5px; float: right;" id="newsLetterFullEmail">Email:<br /><input style="width:150px" name="emailNewsletterTop" id="emailNewsletterTop" type="text" maxlength="32"><input value="1" name="flagTop" type="hidden"></div>';
TopMenu += '	  			<div id="newsLetterBr" style="clear:both;"><br style="clear:both;" />';
TopMenu += '	  			<br /></div></div>';
TopMenu += '	  			<div style="font-weight:bold;">Kategori berita yang diinginkan:</div><br />';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop1" value="46" /> Selebriti</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop2" value="40" /> Film</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop3" value="41" /> Musik</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop4" value="42" /> Televisi</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop5" value="43" /> Hollywood</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop6" value="44" /> Bollywood</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop7" value="45" /> Asian Star</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop8" value="47" /> Sinetron</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop9" value="32" /> Bola Internasional</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop10" value="31" /> Bola Nasional</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop11" value="33" /> Seleb-OR</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop12" value="30" /> Olahraga Lain-lain</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop13" value="50" /> Hukum-Kriminal</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop14" value="52" /> Kasus Narkoba</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop15" value="10" /> Politik Nasional</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop16" value="11" /> Politik Internasional</div>';
TopMenu += '	  			<div style="width:145px;float:left;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop17" value="20" /> Ekonomi Nasional</div>';
TopMenu += '	  			<div style="width:165px;float:right;padding:2px 0px;"><input name="pilihcat[]" type="checkbox" id="checkboxTop18" value="21" /> Ekonomi Internasional</div>';
TopMenu += '	  			<br style="clear:both" />';
TopMenu += '	  			<br />';
TopMenu += '                             <div id="registerNewsLetterInfoTop"></div>';
TopMenu += '	  			<div style="clear: both; text-align: right; padding-top: 5px;">';
TopMenu += '                                           <input class="button" type="button" value="Tutup form ini" onclick="javascript: document.getElementById(\'newsTopInfoDaftar\').style.display = \'none\';" />';
TopMenu += '                                           <input value="    Daftar    " name="B1" class="button" onclick="javascript: registerNewsLetterDataTop(this);" type="submit">';
TopMenu += '                                       </div>';
TopMenu += '	  		</form>';
TopMenu += '	  	</div>';
TopMenu += '	  </div>';
TopMenu += '	</div>';
TopMenu += '               <div style="clear: both;"></div>';
TopMenu += '            </div>';


document.write(TopMenu);

/* Script by: www.jtricks.com
 * Version: 20070703
 * Latest version:
 * www.jtricks.com/javascript/window/box_centered.html
 */
var has_inner = typeof(window.innerWidth) == 'number';
//var has_higher = typeof(window.innerHeight) == 'number';
var has_element = document.documentElement
    && document.documentElement.clientWidth;
var reload_page = false;
// Moves the box object to be centered on current
// viewable area of the page
function center_box(box, width, height)
{
    var has_inner = typeof(window.innerHeight) == 'number';
    var has_element = document.documentElement && document.documentElement.clientWidth;
    cleft = has_inner
        ? window.pageXOffset + 
          (window.innerWidth - width)/2
        : has_element
          ? document.documentElement.scrollLeft + 
            (document.documentElement.clientWidth - width)/2
          : document.body.scrollLeft + 
            (document.body.clientWidth - width)/2;
    ctop = has_inner
        ? window.pageYOffset + (window.innerHeight - height)/2
        : has_element
          ? document.documentElement.scrollTop + 
            (document.documentElement.clientHeight - height)/2
          : document.body.scrollTop + 
            (document.body.clientHeight - height)/2;
//var ctop = '400';
    box.style.left = cleft > 0 ? cleft + 'px' : '0px';
    box.style.top = ctop > 0 ? ctop + 'px' : '0px';
}

// Hides other alone popup boxes that might be displayed
function hide_other_alone(obj)
{
    if (!document.getElementsByTagName)
        return;

    var all_divs = document.body.getElementsByTagName("DIV");

    for (i = 0; i < all_divs.length; i++)
    {
        if (all_divs.item(i).style.position != 'absolute' ||
            all_divs.item(i) == obj ||
            !all_divs.item(i).alonePopupBox)
        {
            continue;
        }

        all_divs.item(i).style.display = 'none';
    }
    return;
}

// Shows a box if it wasn't shown yet or is hidden
// or hides it if it is currently shown
function show_hide_centered_box(an, width, height, borderStyle)
{
    if(borderStyle == '1'){
    var width = '648';
    var height = '385';
    }else if(borderStyle == '2'){
        var width = '648';
    var height = '380';
    }else if(borderStyle == '3'){
        var width = '648';
    var height = '445';
    }else if(borderStyle == '4'){
        var width = '648';
    var height = '445';
    }else if(borderStyle == '5'){
        var width = '648';
    var height = '245';
    }else{
     var width = '648';
    var height = '380';
    }
    show_hide_centered_href(
        an.href, width, height, borderStyle);
    return false;
}

// Shows a box if it wasn't shown yet or is hidden
// or hides it if it is currently shown
function show_hide_centered_href(href, width, height, borderStyle)
{
    var boxdiv = document.getElementById(href);

    if (boxdiv != null)
    {
        if (boxdiv.style.display=='none')
        {
            hide_other_alone(boxdiv);
            // Show existing box, move it
            // if document changed layout
            center_box(boxdiv, width, height);
            boxdiv.style.display='block';

            // Workaround for Konqueror/Safari
            if (!boxdiv.contents.contentWindow)
                boxdiv.contents.src = href;
        }
        else
            // Hide currently shown box.
            boxdiv.style.display='none';
        return false;
    }

    hide_other_alone(null);

    // Create box object through DOM
    boxdiv = document.createElement('div');

    // Assign id equalling to the document it will show
    boxdiv.setAttribute('id', href);

    // Add object identification variable
    boxdiv.alonePopupBox = 1;
    boxdiv.overflowX = 'hidden';
    boxdiv.overflowY = 'hidden';
    boxdiv.style.display = 'block';
    boxdiv.style.position = 'absolute';
    boxdiv.style.width = width + 'px';
    boxdiv.style.height = height + 'px';
    boxdiv.style.border = '1px solid';
    boxdiv.style.textAlign = 'right';
    boxdiv.style.padding = '5px';
    boxdiv.style.background = '#FFFFFF';
    document.body.appendChild(boxdiv);

    var offset = 0;

    // Remove the following code if 'Close' hyperlink
    // is not needed.
    var close_href = document.createElement('a');
    close_href.style.fontWeight = 'bold';
    close_href.style.fontSize = '14px';
    close_href.href = 'javascript:void(0);';
    close_href.onclick = function()
    {
        show_hide_centered_href(href, width, height, borderStyle);
        if (reload_page) window.location.reload();
    }

    close_href.appendChild(document.createTextNode('TUTUP [X]'));
    boxdiv.appendChild(close_href);
    offset = close_href.offsetHeight;
    // End of 'Close' hyperlink code.

    var contents = document.createElement('iframe');
    //contents.scrolling = 'no';
    contents.overflowX = 'hidden';
    contents.align = 'center';
    contents.overflowY = 'hidden';
    contents.frameBorder = '0';
    contents.style.textAlign = 'center';
    contents.style.width = width + 'px';    
    contents.style.height = (height - offset) + 'px ';

    boxdiv.contents = contents;
    boxdiv.appendChild(contents);

    center_box(boxdiv, width, height);

    if (navigator.appName == 'Opera')
        contents.contentWindow.document.location.replace(
            href);
    else
        contents.src = href;

    // The script has successfully shown the box,
    // prevent hyperlink navigation.
    return false;
}

var thisPage = location.href.substring((location.href.lastIndexOf("/"))+1);
if(thisPage=="0000260483.html")
{
    $(document).ready(function() {
        var refreshId = setInterval(function()
        {
            $('#counterfans').load('http://www.kapanlagi.com/u/counter_sms.php');
            return false;
        }, 5000);
    });
}

function putText(myField, sValue, eValue) {
   //IE support
   if (document.selection) {
      var scrollPos = myField.scrollTop;
      myField.focus();
      sel = document.selection.createRange();
      sel.text = sValue + sel.text + eValue;
      myField.scrollTop = scrollPos;
   }
   //MOZILLA/NETSCAPE support
   else if (myField.selectionStart || myField.selectionStart == '0') {
      var startPos = myField.selectionStart;
      var endPos = myField.selectionEnd;
      var myValue = sValue + myField.value.substring(startPos,endPos) + eValue;
      var scrollPos = myField.scrollTop;
      var lastPosi = eValue.length + sValue.length + endPos;
      myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
      myField.focus();
      myField.selectionStart = myField.selectionEnd = lastPosi;
      myField.scrollTop = scrollPos;
   } else {
      var myValue = sValue + eValue;
      myField.value += myValue;
   }
}
 
/* function getDataService4(go, action, id, id2, b) 
{
	
	processLoading4(id);
	
	try
	{
		http.open('post', go);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.send(action);

		http.onreadystatechange = function () {
			if(http.readyState == 4) 
			{
				var response = http.responseText;

				if (http.status == 200) 
				{
                                    var sp = response.split('||');
                                
                                    document.getElementById(id).innerHTML = sp[1];
                                    //document.getElementById('adserv').style.display = "none";
				    
                                    if (sp[0] == 'OK')
                                    {
                                        clearForm4(id2);
                                        b.disabled = true;
                                    } else {
                                    	b.disabled = false;
                                    }
				    
				    
                                }
				else 
				{
					alert("ERROR:" + http.status + " Ada masalah pada pengiriman data!");
				}
			}
		}
	}
	catch (e){}
	finally {}
}*/
/*
function putLink(myField) {
   var link = prompt("enter URL (i.e:http://www.kapanlagi.com/", "http://woman.kapanlagi.com/");
   if (link != '' && link != null) {
      var linkTarget = prompt("enter target (i.e: _self; _blank; _top) ", "_blank");
      if (linkTarget != '' && linkTarget != null) {
         //IE support
         if (document.selection) {
            var scrollPos = myField.scrollTop;
            myField.focus();
            sel = document.selection.createRange();
            sel.text = '<a class="bluelink" href="' + link + '" target="'+linkTarget+'">' + sel.text+ '</a>';
            myField.scrollTop = scrollPos;
         }
         //MOZILLA/NETSCAPE support
         else if (myField.selectionStart || myField.selectionStart == '0') {
            var startPos = myField.selectionStart;
            var endPos = myField.selectionEnd;
            var scrollPos = myField.scrollTop;
            var linkHead= '<a class="bluelink" href="' + link + '" target="'+linkTarget+'">';
            var linkTail= '</a>';
            var lastPosi = linkHead.length + linkTail.length + endPos;
            
            var myValue = linkHead +""+ myField.value.substring(startPos, endPos)+"" + linkTail;
            myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
            myField.selectionStart = myField.selectionEnd = lastPosi;
            myField.focus();
            myField.scrollTop = scrollPos;
         } else {
            var myValue = '<a class="bluelink" href="' + link + '"></a>';
            myField.value += myValue;
         }
      }
   }
}

*/
/*function saverate()
{
                        
                        
};*/