
document.write('<script type="text/javascript" src="http://moolah.asia/calculators/js/thickboxtest.js"></script>');

document.write('<link rel="stylesheet" href="http://moolah.asia/calculators/css/thickboxtest.css" type="text/css" media="screen" />');
function Show_Popup(action, userid) {
$('#popup').fadeIn('fast');
$('#window').fadeIn('fast');
}
function Close_Popup() {
$('#popup').fadeOut('fast');
$('#window').fadeOut('fast');
}

function formValidator(){
	// Make quick references to our fields
	
	var asalary=document.getElementById('asalary');	
	var benefits=document.getElementById('benefits');	
	var workinghrs=document.getElementById('workinghrs');	
	
	
	// Check each input in the order that it appears in the form!
	if(isNumeric(asalary, "Please enter the valid dollar amount for your salary")){
		if(isNumericWithDecimal(benefits, "Please enter the valid dollar amount for your benefits")){			
			if(isNumericWithDecimal(workinghrs, "Please enter the valid digit for the working hours")){					//return true;
							
							calculate();
						
			}
	}}
	
	return false;
	
}

function isNumericWithDecimal(elem, helperMsg){
	var numericExpression = /^[-]?\d*\.?\d*$/;
	if(elem.value.match(numericExpression)){
		elem.style.borderColor='#f5f5f5';
		return true;
		
	}else{
		alert(helperMsg);	
		elem.focus();
		elem.style.borderColor='#e70033';
		return false;
	}
}


function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		elem.style.borderColor='#f5f5f5';
		return true;
		
	}else{
		alert(helperMsg);	
		elem.focus();
		elem.style.borderColor='#e70033';
		return false;
	}
}

function calculate()
{
	var asalary=parseFloat(document.getElementById('asalary').value);
	
	if(document.getElementById('benefits').value=='')
	{
		var benefits=0;
	}
	else
		{
	var benefits=parseFloat(document.getElementById('benefits').value);	
		}
		
	if(document.getElementById('workinghrs').value=='')
	{  
		var workinghrs='40';
		
	}
	else
	{
	var workinghrs=parseFloat(document.getElementById('workinghrs').value);
	
	}
	
	var result=(asalary + benefits)/(workinghrs * 12 * 4.2);
	var cpf=result * 15.55/100;
	var cpfperyr=cpf * workinghrs * 12 * 4.2;
	
	document.getElementById('showresult').style.visibility="visible";
	document.getElementById("showresult").style.display="block";
	document.getElementById('result').innerHTML=result.toFixed(2);
	document.getElementById('resulta').innerHTML=asalary.toFixed(2);
	document.getElementById('cpf').innerHTML=cpf.toFixed(2);
	document.getElementById('cpfperyr').innerHTML=cpfperyr.toFixed(2);
	document.getElementById('cal').value='Recalculate';
	document.getElementById('a').innerHTML=asalary.toFixed(2);
}


document.write("<div align='center' width='500'>");
document.write("<form  id='form12' onsubmit='return formValidator()'>");
document.write("<table id='tab'>");
document.write("<tbody>");
document.write("<tr>");
document.write("<td colspan='2'>");
document.write("<h2>How Much Is My Annual Salary Equal To On An Hourly Basis?</h2>");
document.write("</td");
document.write("</tr>");
document.write("<tr>");
document.write("<td colspan='2' style='border-bottom-style:dotted;border-color:#801bbf;border-width:1px;' class='heading'>");
document.write("Are you thinking about quitting your full-time job and freelancing? If you wondered how much your annual salary converts to as an hourly wage, there are several hidden costs to consider. Enter the information requested to learn what your new freelance rate would be.<br/>&nbsp;");
document.write("</td></tr>");
document.write("<tr><td colspan='2'>");
document.write("<font color='#801bbf' ><b>Wage Information</b></font>");
document.write("</td></tr>");
document.write("<tr><td width='75%'>");
document.write("Enter your annual salary");
document.write("</td><td>");
document.write("$<input type='text' id='asalary' size='6'>");
document.write("</td></tr>");
document.write("<tr><td colspan='2'>");
document.write("<font color='#801bbf' ><b>Benifit Information</b></font>");
document.write("</td></tr>");
document.write("<tr><td>");

document.write("What do you get paid in benefits annually?");
document.write("</td><td>");

document.write("$<input tyoe='text' id='benefits' size='6'>");
document.write("</td></tr>");
document.write("<tr><td>");
document.write("How many hours a week are you working?");
document.write("</td><td>");
document.write("&nbsp;&nbsp;<input type='text' size='6' id='workinghrs'>");
document.write("</td></tr>");
document.write("<tr><td colspan='2' align='right'>");
document.write("<input type='submit' id='cal' class='btn' value='calculate'>");
document.write("</td></tr>");
document.write("<tr><td colspan='2'>");
document.write("<div style='visibility:hidden;display:none' id='showresult' name='showresult'>");
document.write("<font color='#801bbf' size='+1'><b>Results</b></font><br/>");
document.write("With your annual salary of $")
document.write("<div id='resulta' style='display:inline;'></div>");
document.write("&nbsp;your new hourly wage is $");
document.write("<div id='result' style='display:inline;'></div><br/><br/> ");
document.write("<font color='#801bbf' size='+1'><b>Hidden costs:</b></font><br/>");
document.write("<p>Consider the following benefits and taxes that you are responsible for as a freelancer. They should be accounted for in your hourly wage:</p><br/><p><b>Health care</b>: The majority of your medical insurance cost previously paid by your employer is now solely your responsibility.</p><p><b>Insurance (life and disability)</b>: Life insurance and long-term disability insurance are no longer provided by your former employer. Take these important insurance benefits into account to protect you and your family in the event of death or if you become unable to work. </p><p style='display:inline;'><b>Social Security and Medicare</b>: The taxes that your employer paid (half was paid by your employer and the other half was taken as a paycheck deduction) is now your full responsibility. That's about $<div id='cpfperyr' style='display:inline;'></div> a year or $<div id='cpf' style='display:inline;'></div> per hour based on your $<div id='a' style='display:inline;'></div> annual salary. </p><br/><br/><p><b>Office Expenses</b>: There are additional tax deductable costs of doing business that you must pay for, including computer equipment and software, office supplies, phone, fax, and high-speed Internet access, and the possibility of hiring additional vendors to support your new business venture.</p><br/><br/>");
document.write("</div>");

document.write("</tbody></table>");

document.write("<div id='foot'>");
document.write("<a href='http://moolah.asia' id='hyper' target='_blank'>Powered By Moolah.asia</a>");
document.write("<a href='http://moolah.asia/disclaimer.php' style='padding-left:30px;' id='hyper'>Disclaimer</a>");
document.write("<a href='#' style='padding-left:30px;' onmouseover='Show_Popup();' id='hyper'>Embed this Calculator</a>");
document.write("</div>"); 

document.write("</form>");
document.write("</div>");
document.write("<center><div id='popup' style='background-image:url(http://moolah.asia/calculators/img/bg.png);display:none;width:450px;height:200px;background-repeat:no-repeat;align:center'><div style='padding-top:18px;padding-left:420px;' ><a href='#' onclick='Close_Popup();' style='text-decoration:none'><img src='http://moolah.asia/calculators/img/x.png' border='0'></a></div><div style='padding-left:10px;text-align:left;padding-left:15px;padding-right:15px;'>To embed this calculator into your site copy the following text and paste it into your HTML page:<br/><br/><textarea cols='50' rows='2'><script language='javascript' src='http://moolah.asia/calculators/saleryconversion.js'></script></textarea></div></div></center>");

