var nonums = /^[0-9]*$/;
var parmtrForBack = null;
var overlay = null;

//===================== CLose overlay here ===================================

         function closeLayer(){
               overlay.hide();
 }


//=====================   ===================================
         function displayVoteSuccessOverlay(){
             var content = '';
             content+= '<table width="70" height="70"  border="0" align="center" cellpadding="6" cellspacing="6" class="vote_success">';
             content+='  <tr>';
             content+='    <td> Thank you for vote !</td>';
             content+='  </tr>';
             content+='  </table>';

         var this_overlay = document.getElementById("vote_success");
                this_overlay.innerHTML = content;

                overlay = new YAHOO.widget.Overlay("vote_success", { xy:[50,270],
                visible: false,
                width:"640px",
                fixedcenter: false,
            effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:7} } );
                    overlay.render();
                overlay.show();

         }



function voteThisArticle(opt,aid,sid)
     {
       var url='../home/voteArticle.php';
       var dataString='options='+opt +'&aid='+aid +'&sid='+sid;
        overlayFormSubmitter.postFormData(url, dataString, 'vote');
     }


 
 function getTeenParentPercentageBar(aid,sid)
     {
       var url='../home/getVotePercent.php';
       //alert(aid)
       var dataString='aid='+aid+'&sid='+sid ;
     //  alert(dataString);
       overlayFormSubmitter.postFormData(url, dataString, 'getVotePercent');
     }




 function drawTeenParentPercentageBar(parent_per,teen_per)
       {
    var content = '';
        content+='<table width="325" height="269" border="0" align="center" cellpadding="0" cellspacing="0">';
        content+='  <tr>';
        content+='    <td valign="top"><table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0">';
        content+='      <tr>';
        content+='        <td colspan="3">&nbsp;</td>';
        content+='      </tr>';
        content+='      <tr>';
        content+='         <td width="8%"><div align="right"><img src="../home/image/corner_left_top.gif" width="30" height="30" /></div></td>';
        content+='         <td width="82%" background="../home/image/bg_top.gif">&nbsp;</td>';
        content+='         <td width="10%"><div onclick="closeLayer();" class="cursor_hand"><img src="../home/image/corner_right_top.gif" width="30" height="30" /></div></td>';
        content+='      </tr>';
        content+='     </table>';
        content+='     <table width="325" border="0" align="center" cellpadding="2" cellspacing="0">';
        content+='       <tr> </tr>';
        content+='        <tr> ';
        content+='          <td background="../home/image/bg_middle_overlay.gif">&nbsp;</td>';
        content+='        </tr>';
        content+='        <tr>';
        content+='          <td background="../home/image/bg_middle_overlay.gif"><table width="100%" border="0" cellspacing="2" cellpadding="2"> ';
        content+='             <tr>';
        content+='               <td width="3%">&nbsp;</td>';
        content+='               <td width="16%" class="parent"></td> ';
        content+='               <td width="7%"><img src="../home/image/parent_icon.gif" width="22" height="22" /></td>';
        content+='               <td width="42%" bgcolor="#FFFFFF" class="boxProcessBar">';
     if(parent_per!=0)
      { 
        content+='                   <table width="'+parent_per+'%" border="0" align="left" cellpadding="0" cellspacing="0"> ';
        content+='                     <tr>';
        content+='                       <td bgcolor="#88BE10">&nbsp;</td>';
        content+='                     </tr>';
        content+='                 </table>';
      }
        content+='                </td>';
        content+='               <td width="20%" class="parent">'+parent_per+'%</td>';
        content+='               <td width="12%">&nbsp;</td> ';
        content+='              </tr>';
        content+='              <tr>';
        content+='                <td>&nbsp;</td>';
        content+='                <td colspan="5" class="parent">&nbsp;</td>';
        content+='              </tr> ';
        content+='              <tr>';
        content+='                <td>&nbsp;</td> ';
        content+='                <td class="parent"></td> ';
        content+='                <td><img src="../home/image/teen_icon.gif" width="21" height="22" /></td>';
        content+='                <td bgcolor="#FFFFFF" class="boxProcessBar">';
     if(teen_per!=0)
      {
        content+='                   <table width="'+teen_per+'%" border="0" align="left" cellpadding="0" cellspacing="0">';
        content+='                       <tr>';
        content+='                         <td bgcolor="#F67F00">&nbsp;</td> ';
        content+='                       </tr>';
        content+='                   </table>';
      }
        content+='                </td>  ';
        content+='                <td width="20%" class="parent">'+teen_per+'%</td>';
        content+='                <td  width="12%">&nbsp;</td> ';
        content+='               </tr>';
        content+='              </table></td>';
        content+='           </tr>';
        content+='           <tr>';
        content+='             <td valign="top" background="../home/image/bg_middle_overlay.gif"><div align="center"></div></td>';
        content+='           </tr>';
        content+='          </table>';
        content+='          <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">';
        content+='            <tr>';
        content+='               <td width="9%"><img src="../home/image/corner_left_bottom.gif" width="30" height="30" /></td>';
        content+='               <td width="85%" bgcolor="#EFF2F7">&nbsp;</td>';
        content+='               <td width="6%"><img src="../home/image/corner_right_bottom.gif" width="30" height="30" /></td>';
        content+='             </tr>';
        content+='          </table></td>';
        content+='        </tr>';
        content+='        <tr> </tr>  ';
        content+='        <tr> </tr>';
        content+='      </table> ';
        content+=' <div align="center" class="body_txt">';
        content+='   <p>&nbsp;</p ';
        content+=' </div>';

             

         var this_overlay = document.getElementById("vote_percent");
                this_overlay.innerHTML = content;

                overlay = new YAHOO.widget.Overlay("vote_percent", { xy:[80,270],
                visible: true,
                zIndex: 40,
                fixedcenter: true,
            effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
                    overlay.render();
                overlay.show(); 
       }


 function explodeArray(item,delimiter) {
tempArray=new Array(1);
var Count=0;
var tempString=new String(item);
while (tempString.indexOf(delimiter)>0) {
tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));
tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);
Count=Count+1
}
tempArray[Count]=tempString;
return tempArray;
}


function test()
   {
alert('tested ok');

  }
