var overlay = null;


         function closeLayer(){
	   var this_overlay = document.getElementById("profileImage");
    this_overlay.innerHTML = "";

               overlay.hide();
 }

//function to validate decimal place

function getKey(e)
      {
        if (window.event)
           return window.event.keyCode;
        else if (e)
           return e.which;
        else
           return null;
      }
 function restrictChars(e, obj)
	{
	var CHAR_AFTER_DP = 2; // number of decimal places
	var validList = "0123456789."; // allowed characters in field
	var key, keyChar;
	key = getKey(e);
	if (key == null) return true;
	// control keys
	// null, backspace, tab, carriage return, escape
	if ( key==0 || key==8 || key==9 || key==13 || key==27 )
	return true;
	// get character
	keyChar = String.fromCharCode(key);
	// check valid characters
	if (validList.indexOf(keyChar) != -1)
		{
		// check for existing decimal point
		var dp = 0;
		if( (dp = obj.value.indexOf( ".")) > -1)
			{
			if( keyChar == ".")
			return false; // only one allowed
			else
			{
			// room for more after decimal point?
			if( obj.value.length - dp <= CHAR_AFTER_DP)
			return true;
			}
			}
		 else return true;
  		}
   		// not a valid character
   		document.getElementById("errormoneyDonate").innerHTML="Please enter amount upto two decimal places.";
		return false;
   }





	function restrictCharswithdraw(e, obj)
        {
        var CHAR_AFTER_DP = 2; // number of decimal places
        var validList = "0123456789."; // allowed characters in field
        var key, keyChar;
        key = getKey(e);
        if (key == null) return true;
        // control keys
        // null, backspace, tab, carriage return, escape
        if ( key==0 || key==8 || key==9 || key==13 || key==27 )
        return true;
        // get character
        keyChar = String.fromCharCode(key);
        // check valid characters
        if (validList.indexOf(keyChar) != -1)
                {
                // check for existing decimal point
                var dp = 0;
                if( (dp = obj.value.indexOf( ".")) > -1)
                        {
                        if( keyChar == ".")
                        return false; // only one allowed
                        else
                        {
                        // room for more after decimal point?
                        if( obj.value.length - dp <= CHAR_AFTER_DP)
                        return true;
                        }
                        }
                 else return true;
                }
                // not a valid character
                document.getElementById("errormoneyWithdraw").innerHTML="Please enter amount upto two decimal places.";
                return false;
   }


function checkDec(str) {

	    theNum = xElement.toString();
	    var regExp = /^\d{0,}\.\d{2}$/;    //format  .## required
          //var regExp = /^\d{1,}\.\d{2}$/;  //format #.## required
         var formatLine = theNum.match(regExp);
         if(!formatLine){ //Test if there was no match
			return false;
			}
		else {
			return true;
		     }		 
	  }

function DecWithdraw(With){
            theNum = With.toString();
            var regExp = /^\d{0,}\.\d{2}$/;    //format  .## required
          //var regExp = /^\d{1,}\.\d{2}$/;  //format #.## required
         var formatLine = theNum.match(regExp);
         if(!formatLine){ //Test if there was no match
			return false;
                        }
	 else 
		{
		return true;
		}
          }


function userimage(){

	var content = '';
	content +='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	content +='<tr>';
        content +='<td align="center" valign="top">&nbsp;</td>'; 
        content +='</tr>';
        content +='<tr>';
        content +='<td height="268" align="center" valign="top"><form name="Image" ENCTYPE="multipart/form-data" method="POST" action="">';
	content +='<table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';

        content+='<tr>';
        content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
        content+='<td width="327" height="33" background="../image/upload_image.gif">&nbsp;</td>';
        content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide()" /></a></td>';
      content+='</tr>';
        content +='<tr>';
        content +='<td height="228"  width="412" colspan="3" align="left" valign="top">';
	content +='<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
        content +='<tr>';
        content +='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
        content +='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
        content +='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
        content +='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
        content +='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
        content +='</tr>';
        content +='<tr>';
        content +='<td height="6" colspan="3">';
	content +='</td>';
        content +='</tr>';
        content +='<tr>';
        content +='<td height="28" align="left" valign="middle" class="text2">Upload Image </td>';
        content +='<td height="28" align="center" valign="middle"><span class="text2">:</span></td>';
        content +='<td height="28" align="center" valign="middle"><input type="file"  name="picture_url" /></td>';
        content +='</tr>';
          
        content +='<tr>';
        content +='<td height="28" align="left" valign="middle">&nbsp;</td>';
        content +='<td height="28" align="center" valign="middle">&nbsp;</td>';
         content +='<td height="28" align="left" valign="middle" style="padding-left:24px;"><input type="submit" name="upload" value="Upload" onclick="return chkimages();"/></td>';
         content +='</tr>';
         content +='<tr>';
         content +='<td align="left" valign="middle">&nbsp;</td>';
         content +='<td align="center" valign="middle">&nbsp;</td>';
         content +='<td height="19" align="center" valign="middle">&nbsp;</td>';
         content +='</tr>';
         content +='</table></td>';
         content +='</tr>';
         content +='<tr>';
         content +='<td height="7" background="images/left_bg.gif" ><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
         content +='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
         content +='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
         content +='</tr>';
         content +='</table></form>';
	 content +='</td>';
         content +='</tr>';
         content +='</table>';
   var this_overlay = document.getElementById("profileImage");
    this_overlay.innerHTML = content;
    overlay = new YAHOO.widget.Overlay("profileImage", { xy:[300,200],
    visible:true,
    width:"500px",
    fixedcenter: true,
    effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
    overlay.render();
    overlay.show();
}


function chkimages(){

        if(document.Image.picture_url.value ==""){

                alert("Please Upload Image.");
                return false;
        }

        var imagePath = document.Image.picture_url.value;
        var pathLength = imagePath.length;
        var lastDot = imagePath.lastIndexOf(".");
        var fileType = imagePath.substring(lastDot,pathLength);

        if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG") || (fileType == ".bmp") ||(fileType == ".BMP")) {
return true;
        } else {
                alert("We supports .JPG, .PNG, .GIF, .BMP image formats. Your file-type is " + fileType + ". Please upload file of these extension.");
                return false;
        }
}

function forgotpassword(){
        var content = '';
	content +='<form name="passwordform" ENCTYPE="multipart/form-data" method="POST" action="">';
        content +='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
        content +='<tr>';
    content +='<td align="center" valign="top">&nbsp;</td>';
  content +='</tr>';
  content +='<tr>';
    content +='<td height="268" align="center" valign="top">';
        content +='<table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
     content +='<tr>';
        content +='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" />';
        content +='</td>';
        content +='<td width="327" height="33" background="../image/forgot_password.gif">&nbsp;</td>';
				   content +='<td width="35"><img src="../image/close_btn.gif" width="35" height="33" border="0" onclick="overlay.hide()" /></td>';
      content +='</tr>';
      content +='<tr>';
        content +='<td height="228" colspan="3" align="left" valign="top">';
     content +='<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x" id="emailMessage">';
          content +='<tr>';
          content +='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
            content +='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
            content +='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
           content +='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
          content +='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
          content +='</tr>';
          content +='<tr>';
          content +='<td height="6" colspan="3">';
		content +='<div id="errorforgotPassword"  align="center"></div>';
          content +='</td>';
          content +='</tr>';
          content +='<tr>';
            content +='<td height="28" align="left" valign="middle" class="text2">Email</td>';
            content +='<td height="28" align="center" valign="middle"><span class="text2">:</span></td>';
            content +='<td height="28" align="center" valign="middle"><input type="text"  name="passwordText" /></td>';
		content +='</tr>';

          content +='<tr>';
            content +='<td height="28" align="left" valign="middle">&nbsp;</td>';
            content +='<td height="28" align="center" valign="middle">&nbsp;</td>';
         content +='<td height="28" align="left" valign="middle" style="padding-left:24px;"><img src="../image/submit_btn.gif" width="86" height="26"  onclick="return submitformForgotPassword();"   /></td>';
          content +='</tr>';
          content +='<tr>';
            content +='<td align="left" valign="middle">&nbsp;</td>';
            content +='<td align="center" valign="middle">&nbsp;</td>';
            content +='<td height="19" align="center" valign="middle">&nbsp;</td>';
          content +='</tr>';
        content +='</table></td>';
      content +='</tr>';
      content +='<tr>';
  content +='<td height="7" background="images/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
     content +='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
        content +='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
      content +='</tr>';
    content +='</table>';
        content +='</td>';
  content +='</tr>';
content +='</table>';
content +='</form>';
var this_overlay = document.getElementById("forgotpassworddiv");
    this_overlay.innerHTML = content;
    overlay = new YAHOO.widget.Overlay("forgotpassworddiv", { xy:[300,200],
    visible:true,
    width:"500px",
    fixedcenter: true,
    effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
    overlay.render();
    overlay.show();

}

	function submitformForgotPassword(){

                var login=document.passwordform.passwordText.value;

                        if(login=='') {
                                document.getElementById("errorforgotPassword").innerHTML="Please insert your email.";
                                return false;
                        }
                        var url="../user/forgotPassword.php?email="+login;
         // 		alert(url); 
		        var dataString="";
                        var testforgotpassword =overlayFormSubmitterforgotpassword.postFormData(url,dataString,'');

	
}





	
//**************************************************************************************

function loginForm(){

var content="";
content+='<form name="votecheck" action="" method="POST" onsubmit="overlay.hide()">';	
content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">&nbsp;</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/overlay.js"><img src="../image/user_login.gif"></td>';
content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0" onclick="closeLayer()"/></a></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="228" colspan="3" align="left" valign="top">';
content+='<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';

content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="6" colspan="3" id="error"></td>';
content+='</tr>';

content+='<tr>';
content+='<td height="28" align="left" valign="middle" class="text2">User Name </td>';
content+='<td height="28" align="center" valign="middle" class="text2">::</td>';
content+='<td height="28" align="center" valign="middle"><input name="loginEmail" type="text" class="textfield2" ></td>';
content+='</tr>';
          
content+='<tr>';
content+='<td height="28" align="left" valign="middle" class="text2">Password </td>';
content+='<td height="28" align="center" valign="middle"><span class="text2">::</span></td>';
content+='<td height="28" align="center" valign="middle"><input name="loginPassword" type="password" class="textfield2" ></td>';
content+='</tr>';
          
content+='<tr>';
content+='<td height="28" align="left" valign="middle">&nbsp;</td>';
content+='<td height="28" align="center" valign="middle">&nbsp;</td>';
content+='<td height="28" align="left" valign="middle" style="padding-left:24px;"><img src="../image/submit_btn.gif" width="86" height="26" onclick=" return submitform()" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td align="left" valign="middle">&nbsp;</td>';
content+='<td align="center" valign="middle">&nbsp;</td>';
content+='<td height="19" align="center" valign="middle">&nbsp;</td>';
content+='</tr>';
content+='</table>';
content+='</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
content+='</table>';
content+='</td>';
content+='</tr>';
content+='</table>';
content+='</form>';
   var this_overlay = document.getElementById("profileImage");
    this_overlay.innerHTML = content;
    overlay = new YAHOO.widget.Overlay("profileImage", { xy:[300,200],
    visible:true,
    width:"500px",
    fixedcenter: true,
    effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
    overlay.render();
    overlay.show();
	

}
function submitform(){
	
		var login=document.votecheck.loginEmail.value;
		var password=document.votecheck.loginPassword.value;
			
			if(login=='' || password==''){
				document.getElementById("error").innerHTML="Please insert Username/Password.";
				return false;
			}
			var url="../user/login.php?password="+password+"&username="+login;
			var dataString="";
			var test =overlayFormSubmitter.postFormData(url,dataString,'');
			 	
}
//***************************************Change password*****************************

		function changePassword(){
				var content="";			
	content+='<form name="changepassword" ENCTYPE="multipart/form-data" method="POST" action="">';
	content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	content+='<tr>';
	content+='<td align="center" valign="top">&nbsp;</td>';
 	content+='</tr>';
 	content+='<tr>';
    	content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
     	content+='<tr>';
        content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
        content+='<td width="327" height="33" background="../image/change_password.gif">&nbsp;</td>';
        content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide()" /></a></td>';
      content+='</tr>';
      content+='<tr>';
        content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
          content+='<tr>';
            content+='<td width="50" rowspan="8" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
            content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
           content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
            content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
            content+='<td width="35" rowspan="8" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" />';
		content+='</td>';
          content+='</tr>';
          content+='<tr>';
            content+='<td height="6" colspan="3">';
		content +='<div id="errorchangePassword"  align="center"></div>';
		content+='</td>';
            content+='</tr>';
          content+='<tr>';
            content+='<td height="28" align="left" valign="middle" class="text2">Enter Your e-mail</td>';
            content+='<td height="28" align="center" valign="middle" class="text2">::</td>';
            content+='<td height="28" align="center" valign="middle"><input name="email" type="text" class="textfield2" /></td>';
            content+='</tr>';
          content+='<tr>';
            content+='<td height="28" align="left" valign="middle" class="text2">Enter Old Password</td>';
            content+='<td height="28" align="left" valign="middle"><span class="text2">::</span></td>';
            content+='<td height="28" align="center" valign="middle"><input name="oldpassword" type="password" class="textfield2" /></td>';
            content+='</tr>';
          content+='<tr>';
           content+='<td height="28" align="left" valign="middle" class="text2">Enter New Password</td>';
            content+='<td height="28" align="center" valign="middle"><span class="text2">::</span></td>';
            content+='<td height="28" align="center" valign="middle"><input name="newpassword" type="password" class="textfield2" /></td>';
          content+='</tr>';
          content+='<tr>';
            content+='<td height="28" align="left" valign="middle" class="text2">Retype Password</td>';
            content+='<td height="28" align="center" valign="middle"><span class="text2">::</span></td>';
            content+='<td height="28" align="center" valign="middle"><input name="retypepassword" type="password" class="textfield2" /></td>';
          content+='</tr>';
          
          content+='<tr>';
           content+='<td height="28" align="left" valign="middle">&nbsp;</td>';
            content+='<td height="28" align="center" valign="middle">&nbsp;</td>';
           content+='<td height="28" align="left" valign="middle" style="padding-left:24px;"><img src="../image/submit_btn.gif" width="86" height="26"  onclick="submitformChangePassword()";/></td>';
          content+='</tr>';
          content+='<tr>';
            content+='<td align="left" valign="middle">&nbsp;</td>';
            content+='<td align="center" valign="middle">&nbsp;</td>';
            content+='<td height="19" align="center" valign="middle">&nbsp;</td>';
          content+='</tr>';
        content+='</table></td>';
      content+='</tr>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
    
content+='</table></td>';
  content+='</tr>';
content+='</table>';
content+='</form>';
	var this_overlay = document.getElementById("changepassworddiv");
  	  this_overlay.innerHTML = content;
  	  overlay = new YAHOO.widget.Overlay("changepassworddiv", { xy:[300,200],
 	   visible:true,
  	  width:"500px",
 	   fixedcenter: true,
  	  effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
  	  overlay.render();
 	   overlay.show();
}
function submitformChangePassword(){

                var email=document.changepassword.email.value;
		var oldpassword=document.changepassword.oldpassword.value;	
		var newpassword=document.changepassword.newpassword.value;
		var retypenewpassword=document.changepassword.retypepassword.value;	
                     //   if(email=='') {
                       //         document.getElementById("errorchangePassword").innerHTML="Please insert your email.";
                               
                        //}
			
                        var url="../user/changePassword.php?email="+email+"&newpassword="+newpassword+"&retypepassword="+retypenewpassword+"&oldpassword="+oldpassword;
        //             alert(url);
                        var dataString="";
                        var testchangepassword =overlayFormSubmitterchangepassword.postFormData(url,dataString,'');


}


			function MoneyDonate(total_earning){
				var content="";
content+='<form name="moneyDonate" ENCTYPE="multipart/form-data" method="POST" action="">';
content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">';
content +='&nbsp;</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/money_donate.gif">&nbsp;</td>';
content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide();document.moneyDonate.submit()"/></a></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
content+='<td align="center" valign="top" >';
content +='</td>';
content+='</tr>';
content+='<tr>';
content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="6" colspan="3" class="formtext_error"><div id="errormoneyDonate"  align="center"></div></td>';
content+='</tr>';
content+='<tr><td colspan="3"><div id="donateSucess"><table  width="100%"border="0" cellpadding="0" cellspacing="0"><tr>';
content+='<td height="28" align="left" valign="middle" class="formtext">Banked Earnings </td>';
content+='<td height="28" align="center" valign="middle" class="text2">::</td>';
content+='<td height="28" align="left" valign="middle" class="formtext2"" style="padding-left:30px;">$'+total_earning+'</td>';
content+='</tr>';
          
content+='<tr>';
content+='<td height="28" align="left" valign="middle" class="formtext">Money Donate </td>';
content+='<td height="28" align="center" valign="middle"><span class="text2">::</span></td>';
content+='<td height="28" align="center" valign="middle"><input name="money_donate" type="text" class="reg_txtfield" value=""  onKeyPress="return restrictChars(event, this)"/></td>';
content+='</tr>';
          
content+='<tr>';
content+='<td height="28" align="left" valign="middle">&nbsp;</td>';
content+='<td height="28" align="center" valign="middle">&nbsp;</td>';
content+='<td height="28" align="left" valign="middle" style="padding-left:10px;"><a href="#"><img src="../image/submit_btn.gif" width="86" height="26" border="0" onclick="submitformDonate('+total_earning+')"/></a></td>';
content+='</tr></table></div></td></tr>';
content+='<tr>';
content+='<td align="left" valign="middle">&nbsp;</td>';
content+='<td align="center" valign="middle">&nbsp;</td>';
content+='<td height="19" align="center" valign="middle">&nbsp;</td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='</table>';
content+='</form>';
	var this_overlay = document.getElementById("moneydonate");
          this_overlay.innerHTML = content;
          overlay = new YAHOO.widget.Overlay("moneydonate", { xy:[300,200],
           visible:true,
          width:"500px",
           fixedcenter: true,
          effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
          overlay.render();
           overlay.show();
}

function submitformDonate(total_earning){

                var money_donate=document.moneyDonate.money_donate.value;
		if(money_donate==''|| money_donate==0)
		      {
		      document.getElementById("errormoneyDonate").innerHTML="Please enter valid amount.";
		      money_donate='';	
		      }
		else if(!IsNumeric(money_donate))
                        {
                        document.getElementById("errormoneyDonate").innerHTML="Please enter valid amount.";
                        money_donate='';
                        }
		else if(money_donate>total_earning)
			{
 	                document.getElementById("errormoneyDonate").innerHTML="Amount should be less than total amount.";
			money_donate='';
			}
		else {
                        var url="../user/donate.php?amount="+money_donate;
                        //alert(url);
                        var dataString="";
                      var testmoneyDonate =overlayFormSubmitterMoneyDonate.postFormData(url,dataString,'');
		     }
}

		function MoneyWithdraw(total_earning){
				
                                var content="";
content+='<form name="moneyWithdraw" ENCTYPE="multipart/form-data" method="POST" action="">';
content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">&nbsp;</td>';
content+='</tr>';
content+='<tr>';
	content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/money_withdraw.gif">&nbsp;</td>';
	content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide();document.moneyWithdraw.submit()"/></a></td>';
content+='</tr>';
content+='<tr>';
	content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
	content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
		content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="6" colspan="3" class="formtext_error"><div id="errormoneyWithdraw"  align="center"></div></td>';
content+='</tr>';
content+='<tr><td colspan="3" height="28"><div id="withdrawSucess"><table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>';
content+='<td height="28" align="left" valign="middle" class="formtext">Banked Earnings</td>';
content+='<td height="28" align="center" valign="middle" class="text2">::</td>';
content+='<td height="28" align="left" valign="middle" class="formtext2" style="padding-left:30px;" >$'+total_earning+'</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="28" align="left" valign="middle" class="formtext">Money Withdraw </td>';
content+='<td height="28" align="center" valign="middle"><span class="text2">::</span></td>';
	content+='<td height="28" align="center" valign="middle"><input name="money_withdraw" type="text" class="reg_txtfield" value=""  onKeyPress="return restrictCharswithdraw(event, this)"/></td>';
content+='</tr>';

content+='<tr>';
content+='<td height="28" align="left" valign="middle">&nbsp;</td>';
content+='<td height="28" align="center" valign="middle">&nbsp;</td>';
	content+='<td height="28" align="left" valign="middle" style="padding-left:10px;"><a href="#"><img src="../image/submit_btn.gif" width="86" height="26" border="0" onclick="submitformWithdraw('+total_earning+')"/><a></td>';
content+='</tr></table></div></td></tr>';
content+='<tr>';
content+='<td align="left" valign="middle">&nbsp;</td>';
content+='<td align="center" valign="middle">&nbsp;</td>';
content+='<td height="19" align="center" valign="middle">&nbsp;</td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='</table>';
content+='</form>';
	var this_overlay = document.getElementById("moneywithdraw");
	
          this_overlay.innerHTML = content;
          overlay = new YAHOO.widget.Overlay("moneywithdraw", { xy:[300,200],
           visible:true,
          width:"500px",
fixedcenter: true,
          effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
          overlay.render();
           overlay.show();
}
function submitformWithdraw(total_earning){

                var money_withdraw=document.moneyWithdraw.money_withdraw.value;
		

		if(money_withdraw==''|| money_withdraw==0)
                      {
                      document.getElementById("errormoneyWithdraw").innerHTML="Please enter valid amount.";
                      money_withdraw='';
                      }
                else if(!IsNumeric(money_withdraw))
                        {
                        document.getElementById("errormoneyWithdraw").innerHTML="Please enter valid amount.";
                        money_withdraw='';
                        }
                else if(money_withdraw>total_earning)
                        {
                document.getElementById("errormoneyWithdraw").innerHTML="Amount should be less than total amount.";
                        money_withdraw='';
                        }
                else {
                        var url="../user/withdraw.php?amount="+money_withdraw;
                        var dataString="";
                        var testMoneyWithdraw =overlayFormSubmitterMoneyWithdraw.postFormData(url,dataString,'');

		    }
}





	function alreadyVoted(){
                                var content="";

content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">&nbsp;</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/already_voted.gif">&nbsp;</td>';
content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide()"/></a></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="6" colspan="3"></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="28" align="center" valign="middle" class="text2" colspan="3">You have already voted today.. </td>';
content+='</tr>';
content+='<tr>';
content+='<td height="28" align="left" valign="middle" class="text2"> </td>';
content+='<td height="28" align="center" valign="middle"><span class="text2"></span></td>';
content+='<td height="28" align="center" valign="middle"></td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='</table>';
        var this_overlay = document.getElementById("alreadyVoted");
          this_overlay.innerHTML = content;
          overlay = new YAHOO.widget.Overlay("alreadyVoted", { xy:[300,200],
           visible:true,
          width:"500px",
		fixedcenter: true,
          effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
          overlay.render();
           overlay.show();
}


function reportit(question_id){
var question_id=question_id;
//alert(question_id);
var content="";
content+='<form name="reportThis" ENCTYPE="multipart/form-data" method="POST" action="">';
content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">&nbsp;</td>';
content+='</tr>';
content+='<tr>';
content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/report_this.gif">&nbsp;</td>';
content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide()"/></a></td>';
content+='</tr>';
content+='<tr>';
content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
content+='<td align="center" valign="top" >';
content +='</td>';
content+='</tr>';
content+='<tr>';
content+='<tr>';
content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';
content+='<td  colspan="3"><div id="errorReport" valign="top" class="formtext_error" align="left"></div></td>';
content+='</tr>';
content+='<tr><td colspan="3" height="6" valign="top"><div id="errorReportThis"><table><tr><td  align="left" valign="top" class="text2" colspan="3"><span class="linkQaList">Reasons to report this question:</span<br><span class="textfield">1. Violates the <a href="TnC.php" class="formtext">Terms of Use</a>.(Example: Chat or rant,adult content, spam, offensive language).<br><br/>2. Question is illegal.  (Example: Harming minors, threats, harassment, privacy invasion, fraud, phishing)</span> </td></tr><tr><td  colspan="3" class="grytext" style="text-decoration: none;"><br>Are you sure you want to report this qusetion?</td></tr></span><tr><td align="left" valign="top" class="text2"><a href="#" ><img src="../image/yes_btn.gif" border="0" onclick="submitReport('+question_id+');"></a></td><td align="left" valign="top" colspan="2" class="text2"><a href="#"><img src="../image/no_btn.gif" border="0" onclick="overlay.hide()"></a></td></tr></table></div></td></tr>';
content+='</table></td>';
content+='<tr>';
content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';
content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';
content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';
content+='</tr>';
content+='</table></td>';
content+='</tr>';
content+='</table>';
content+='</form>';
        var this_overlay = document.getElementById("reportThis");
 this_overlay.innerHTML = content;
          overlay = new YAHOO.widget.Overlay("reportThis", { xy:[300,200],
           visible:true,
          width:"500px",
fixedcenter: true,
          effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );
          overlay.render();
           overlay.show();
}
function submitReport(question_id)
{
var url="../user/reportThis.php?question_id="+question_id;
                        var dataString="";
                        var testReportThis =overlayFormSubmitterReportThis.postFormData(url,dataString,'');

}


function bestAnswerFunction(bestAnswerId,questionId){

var answer_id=bestAnswerId;
var questionId =questionId;

var content="";
content+='<form name="bestAnsweroverlay" ENCTYPE="multipart/form-data" method="POST" action="">';
content+='<table width="100%" border="0" cellspacing="0" cellpadding="0">';
content+='<tr>';
content+='<td align="center" valign="top">&nbsp;</td>';
content+='</tr>';
content+='<tr>';
	content+='<td height="268" align="center" valign="top"><table width="412" border="0" cellpadding="0" cellspacing="0" bgcolor="#FCFEFF">';
content+='<tr>';
content+='<td width="50"><img src="../image/logo_comp.gif" width="50" height="33" /></td>';
content+='<td width="327" height="33" background="../image/best_answer.gif">&nbsp;</td>';
	content+='<td width="35"><a href="#"><img src="../image/close_btn.gif" width="35" height="33" border="0"  onclick="overlay.hide()"/></a></td>';
content+='</tr>';
content+='<tr>';
	content+='<td height="228" colspan="3" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="../image/body_bg.gif" style="background-repeat:repeat-x">';
content+='<tr>';
	content+='<td width="50" rowspan="6" align="left" valign="top" background="../image/left_bg.gif"><img src="../image/lft_vert_line.gif" width="50" height="228" /></td>';
content+='<td width="135" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="9" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
content+='<td width="183" height="8" background="../image/line_top.gif" style="background-repeat:repeat-x">&nbsp;</td>';
	content+='<td width="35" rowspan="6" align="right" valign="top" background="../image/right_bg.gif"><img src="../image/right_vert_line.gif" width="35" height="228" /></td>';
content+='</tr>';
content+='<tr>';                                                                                                            content+='<td  colspan="3"><div id="errorReport" valign="top" class="formtext_error" align="left"></div></td>';             content+='</tr>';                                  
			content+='<tr><td colspan="3" height="6" valign="top" align="center"><div id="errorBestAnswer"><table><tr><td  align="center" valign="top" class="textfield" colspan="3"><br>Are you sure this is the Best Answer?</br> You cannot change this in the future!.</td></tr><tr><td align="center" valign="top" class="text2"><a href="#" ><img src="../image/yes_btn.gif" border="0" onclick="submitBestAnswer('+answer_id+','+questionId+');" name="best"></a></td><td align="center" valign="top" colspan="2" class="text2"><a href="#"><img src="../image/no_btn.gif" border="0" onclick="overlay.hide()"></a></td></tr></table></div></td></tr>';    
content+='</table></td>';     
content+='<tr>';    
	content+='<td height="7" background="../image/left_bg.gif"><img src="../image/bottom_lft_corner.gif" width="50" height="7" /></td>';        
	content+='<td width="327" background="../image/bottom_line.gif"><img src="../image/bottom_line.gif" width="6" height="7" /></td>';       
	content+='<td><img src="../image/bottom_right_corner.gif" width="35" height="7" /></td>';   
	content+='</tr>';     
	content+='</table></td>';   
content+='</tr>';   
content+='</table>';   
content+='</form>';   
var this_overlay = document.getElementById("bestAnswerid");    

   this_overlay.innerHTML = content;                       
			  overlay = new YAHOO.widget.Overlay("bestAnswerid", { xy:[300,200], visible:true,width:"500px",fixedcenter: true, effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:1} } );    
overlay.render();   
  overlay.show();

	}

function submitBestAnswer(answer_id,questionId)

{

var url="../user/bestAnswer.php?bestanswer="+answer_id+"&questionId="+questionId;

                        var dataString="";

                        var testReportThis =overlayFormSubmitterBestAnswer.postFormData(url,dataString,'');

}
                                      
