// JavaScript Document
var temp_form = new Object;
temp_form.email = false;
temp_form.password = false;
temp_form.valid = false;

function bronze_signup_display() {
	document.getElementById('content').innerHTML = signup_table('bronze');
	document.getElementById('signup_form').innerHTML = bronze_signup_form();
}

function silver_pay_display () {
	var email = _get('email').value;
	var password = _get('password').value;
	var c_password = _get('c_password').value;
	var agree_box = _get('agree_box').checked;
	
	if(!email.match('@')) {
		alert("You must enter a valid email.");
		return false;
	}
	
	if(!password || password.length < 6 || password.length > 12) {
		alert("You did not enter a valid password. Your password must be 6-12 charcters long.");
		return false;
	}
	
	if(password != c_password) {
		alert("Your passwords did not match, you may want to right this down");
		return false;
	}
	
	if(!agree_box) {
		alert("Please Review the Terms of Service");
		return false;
	}
	
	temp_form.email = email;
	temp_form.password = password;
	temp_form.valid = agree_box;
	
	var callback = function (email, password) {
		var display_callback = function () {	
			document.getElementById('signup_form').innerHTML = silver_pay_form();
		}
			check_account_info(email, password, display_callback);
	} 
	encode_p(email, password, callback);
}

function empty_silver_signup_display() {
	document.getElementById('content').innerHTML = signup_table('silver');
}

function silver_signup_display() {
	document.getElementById('content').innerHTML = signup_table('silver');
	document.getElementById('signup_form').innerHTML = silver_signup_form();
}

function jobs_signup_display() {
	document.getElementById('content').innerHTML = signup_table('jobs');
	document.getElementById('signup_form').innerHTML = jobs_signup_form();
}

function free_signup_display() {
	document.getElementById('content').innerHTML = signup_table('free');
	document.getElementById('signup_form').innerHTML = free_signup_form();
}

function signup_display() {
	document.getElementById('content').innerHTML = signup_table();
	document.getElementById('signup_form').innerHTML = signup_form();
	add_focus('email');
}

function signup_table(string) {
	switch (string) {
		case "bronze": 
			var title = "FREE Online Portfolio"; 
			var list = "<b>Let Employers Do the Work.</b><br /> Get your portfolio online"
			+ " and we will help interested contacts find you. Update your information and availability,"
			+ " add images to your account, and upgrade to enhanced services anytime."
			+ "<ul><li>5 images</li><li>1 video/flash</li><li>500 word descriptions</li><li>Update your online resume anytime</li><li>Receive email notifications</li><li>Update your availability</li></ul><br />"
			+ "<b>It's Completely FREE. Get your portfolio online today!</b>";
			break;
		case "silver": 
			var title = "Online Gallery"; 
			var list = "<b>Spend Your Time on Your Own Work.</b><br />Get your Artwork online and we will help interested buyers and employers find you."
			+ "<div style=\"padding: 10px\"><ul><li>50 images</li><li>10 videos/flash</li><li>1000 word descriptions</li>"
			+ "<li>Upload resume attachments</li>"
			+ "<li>Online notifications</li><li>Project based availability</li></ul></div>";
			break;
		case "free": 
			var title = "Online Gallery <sup style=\"color: #EEE; font-size: 10px; font-weight: 50\">FREE!</sup>"; 
			var list = "<b>Spend Your Time on Your Own Work.</b><br />Get your Artwork online and we will help interested buyers and employers find you."
			+ "<ul><li>50 images</li><li>10 videos/flash</li><li>1000 word descriptions</li>"
			+ "<li>Upload resume attachments</li>"
			+ "<li>Online notifications</li><li>Project based availability</li></ul><br />";
			break;
		case "jobs": 
			var title = "FREE Jobs Account"; 
			var list = "<b>Post Jobs and Track Talent.</b><br /> Release updates about work oportunities"
			+ " by keeping track of talented people. Earn a high rating by submitting testimonials about your"
			+ " experiences finding workers through topfolios."
			+ "<ul><li>Save talented contacts</li><li>Post unlimited jobs</li><li>500 word descriptions</li><li>Post jobs anytime</li><li>Receive email notifications</li></ul><br />"
			+ "<b>It's Completely FREE. Get your portfolio online today!</b>";
			break;
		default: var title = "Fill in your account information below";
			var list = "<b>Let Employers Do the Work.</b><br /> Get your portfolio online"
			+ " and we will help interested contacts find you. Update your information and availability,"
			+ " add images to your account, and upgrade to enhanced services anytime."
			+ "<ul><li>10 images</li><li>5 videos/flash</li><li>500 word descriptions</li><li>Update your online resume anytime</li><li>Receive email notifications</li><li>Update your availability</li></ul><br />"
			+ "<b>It's Completely FREE. Get your portfolio online today!</b>";
	}

var table = "<table width=\"100%\" height=\"100%\" border=\"0\" style=\"padding-left: 14px; color: #111\">"
+ "       <tr>"
+ "      <td colspan=\"2\" valign=\"top\">"
+ "      	<h4>" + title + "</h4>"
+ "        <div style=\"margin-top: 4px; margin-bottom: 14px; padding: 14px; background-color: #222; color: #AAA\">"
+ "		        " + list + ""
+ "        </div>"
+ "         <div id=\"signup_form\" style=\"padding-left: 10px\">"
+ "         </div>"
+ "      </td>"
+ "      <td width=\"33%\">&nbsp;</td>"
+ "    </tr>"
+ "    <tr>"
+ "      <td width=\"40%\">&nbsp;</td>"
+ "      <td width=\"27%\">&nbsp;</td>"
+ "      <td>&nbsp;</td>"
+ "    </tr>"
+ "    <tr>"
+ "      <td>&nbsp;</td>"
+ "      <td>&nbsp;</td>"
+ "      <td>&nbsp;</td>"
+ "    </tr>"
+ "  </table>";
  
return table;
}

var signup_form = function () {
	var form = 
        "email<br />"
        + "<input class=\"clean\" id=\"email\" type=\"\" /><br />"
        + "secret password<br />"
        + "<input class=\"clean\" id=\"password\" type=\"password\" /><br />"
        + "confirm password<br />"
        + "<input class=\"clean\" id=\"c_password\" type=\"password\"  onkeypress=\"check_return(event,'submit_signup()')\"/><br />"
        + "<input class=\"clean\" id=\"agree_box\" type=\"checkbox\" /> I have read and agree to the <a onClick=\"window.open('http://topfolios.com/terms.php')\">Terms of Use</a>.<br /><br />"
        + "<input class=\"button\" type=\"submit\" value=\"create\" onclick=\"submit_signup()\"/>";
		return form;
}

var bronze_signup_form = function () {
	var form = 
        "email<br />"
        + "<input class=\"clean\" id=\"email\" type=\"\" /><br />"
        + "secret password<br />"
        + "<input class=\"clean\" id=\"password\" type=\"password\" /><br />"
        + "confirm password<br />"
        + "<input class=\"clean\" id=\"c_password\" type=\"password\"  onkeypress=\"check_return(event,'submit_bronze_signup()')\"/><br />"
        + "<input class=\"clean\" id=\"agree_box\" type=\"checkbox\" /> I have read and agree to the <a onClick=\"window.open('http://topfolios.com/terms.php')\">Terms of Use</a>.<br /><br />"
        + "<input class=\"button\" type=\"submit\" value=\"create\" onclick=\"submit_bronze_signup()\"/>";
		return form;
}

var silver_signup_form = function () {
	var form = "<b>Please provide an email address and password. "
		+ "They will be used for logging in to your account.</b><br />"
        + "<br />email<br />"
        + "<input class=\"clean\" id=\"email\" type=\"\" /><br />"
        + "secret password<br />"
        + "<input class=\"clean\" id=\"password\" type=\"password\" /><br />"
        + "confirm password<br />"
        + "<input class=\"clean\" id=\"c_password\" type=\"password\" onkeypress=\"check_return(event,'submit_silver_signup()')\"/><br />"
        + "<input class=\"clean\" id=\"agree_box\" type=\"checkbox\" /> I have read and agree to the <a onClick=\"window.open('http://topfolios.com/terms.php')\">Terms of Use</a>.<br /><br />"
        + "<input class=\"button\" type=\"submit\" value=\"next\" onclick=\"silver_pay_display()\"/>";
		return form;
}

var silver_pay_form = function () {
	var direct_form = "";
		/* + "<b>Accepting MasterCard & VISA credit cards</b><br />"
		+ "Online Gallery services are available at the low price of $10/mo.<br /> Your payment will be recurring for "
		+ "<select id=\"pay_length\"><option value=\"6\">6 months</option><option value=\"12\">1 year</option><option value=\"24\">2 years</option></select><br />"
        + "<br />Name on Card<br />"
        + "<input class=\"clean\" id=\"card_name\" type=\"\" /><br />"
        + "Card Number<br />"
        + "<input class=\"clean\" id=\"card_number_a\" maxlength=\"4\" style=\"width: 32px\"/>"
        + "<input class=\"clean\" id=\"card_number_b\" maxlength=\"4\" style=\"width: 32px\"/>"
        + "<input class=\"clean\" id=\"card_number_c\" maxlength=\"4\" style=\"width: 32px\"/>"
        + "<input class=\"clean\" id=\"card_number_d\" maxlength=\"4\" style=\"width: 32px\"/><br />"
        + "Expiration Date<br />"
        + "<select id=\"expiration_month\">"
        + "<option value=\"1\">January</option>"
        + "<option value=\"2\">February</option>"
        + "<option value=\"3\">March</option>"
        + "<option value=\"4\">April</option>"
        + "<option value=\"5\">May</option>"
        + "<option value=\"6\">June</option>"
        + "<option value=\"7\">July</option>"
        + "<option value=\"8\">August</option>"
        + "<option value=\"9\">Septemeber</option>"
        + "<option value=\"10\">October</option>"
        + "<option value=\"11\">Novemeber</option>"
        + "<option value=\"12\">December</option>"
        + "</select>"
        + "<select id=\"expiration_year\">"
        + "<option value=\"08\">2008</option>"
        + "<option value=\"09\">2009</option>"
        + "<option value=\"10\">2010</option>"
        + "<option value=\"11\">2011</option>"
        + "<option value=\"12\">2012</option>"
        + "<option value=\"13\">2013</option>"
        + "<option value=\"14\">2014</option>"
        + "<option value=\"15\">2015</option>"
        + "<option value=\"16\">2016</option>"
        + "</select>"
        + "<br />"

    var google_form = "<form action='https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/509637361923538' id='BB_BuyButtonForm' method='post' name='BB_BuyButtonForm'>"
    	+ "	<table cellpadding='5' cellspacing='0' width='1%'>"
        + "	<tr>"
        + "    <td align='right' width='1%'>"
        + "        <select name='item_selection_1'>"
        + "            <option value='1'>$60.00 - Online Gallery - 6 months</option>"
        + "            <option value='2'>$110.00 - Online Gallery - 12 months</option>"
        + "            <option value='3'>$210.00 - Online Gallery - 24 months</option>"
        + "        </select>"
        + "        <input name='item_option_name_1' type='hidden' value='Online Gallery - 6 months'/>"
        + "        <input name='item_option_price_1' type='hidden' value='60.0'/>"
        + "        <input name='item_option_description_1' type='hidden' value='Your services will be enabled for 6 months. You will receive a notice 30 days before your services will expire.'/>"
        + "        <input name='item_option_quantity_1' type='hidden' value='1'/>"
        + "        <input name='item_option_currency_1' type='hidden' value='USD'/>"
        + "        <input name='item_option_name_2' type='hidden' value='Online Gallery - 12 months'/>"
        + "        <input name='item_option_price_2' type='hidden' value='110.0'/>"
        + "        <input name='item_option_description_2' type='hidden' value='Your services will be enabled for 12 months. You will receive a notice 30 days before your services will expire.'/>"
        + "        <input name='item_option_quantity_2' type='hidden' value='1'/>"
        + "        <input name='item_option_currency_2' type='hidden' value='USD'/>"
        + "        <input name='item_option_name_3' type='hidden' value='Online Gallery - 24 months'/>"
        + "        <input name='item_option_price_3' type='hidden' value='210.0'/>"
        + "        <input name='item_option_description_3' type='hidden' value='Your services will be enabled for 24 months. You will receive a notice 30 days before your services will expire.'/>"
        + "        <input name='item_option_quantity_3' type='hidden' value='1'/>"
        + "        <input name='item_option_currency_3' type='hidden' value='USD'/>"
        + "    </td>"
        + "    <td align='left' width='1%'>"
        + "        <input alt='' src='https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=509637361923538&amp;w=121&amp;h=44&amp;style=white&amp;variant=text&amp;loc=en_US' type='image'/>"
        + "    </td>"
        + "	</tr>"
    	+ "	</table>"
		+ "	</form>"
       	+ "<input class=\"button\" type=\"submit\" value=\"submit\" onclick=\"submit_silver_signup()\"/>";
		
	var paypal_form = ""
		+ "<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>"
+ "<input type='hidden' name='cmd' value='_s-xclick'>"
+ "<input type='image' src='https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>"
+ "<img alt='' border='0' src='https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'>"
+ "<input type='hidden' name='encrypted' value='-----BEGIN" 
+ " PKCS7-----MIIHmQYJKoZIhvcNAQcEoIIHijCCB4YCAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIGAEMOgaK9AdWnWTz6hkgLWdp78RBCZIa5VZ87EQP0M2IJECBG8KiGy4IaI7BPxqzHTC8Mm9SW7ccn+5gZ0VzAyFGvIOg6gMRj6ZPIHXhYk3sqTR/6m4uCaHnxnw2mTubSITOyMpm1r8kllHV4RgsuBh4LU85NzhxZchPTjA98HIuMxCzAJBgUrDgMCGgUAMIHkBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECIBevmsCHNFegIHAWNiLZ95bEM5hQ+cOxoK7nXn8UnAQTrF8w0QmSOXIhItwgiwAZ6v1V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cm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFTATBgNVBAoTDFBheVBhbCwgSW5jLjEWMBQGA1UECxQNc2FuZGJveF9jZXJ0czEUMBIGA1UEAxQLc2FuZGJveF9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBXNvPA2Bl/hl9vlj/3cHV8H4nH/q5RvtFfRgTyWWCmSUNOvVv2UZFLlhUPjqXdsoT6Z3hns5sN2lNttghq3SoTqwSUUXKaDtxYxx5l1pKoG0Kg1nRu0vv5fJ9UHwz6fo6VCzq3JxhFGONSJo2SU8pWyUNW+TwQYxoj9D6SuPHHRTGCAaQwggGgAgEBMIGeMIGYMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFTATBgNVBAoTDFBheVBhbCwgSW5jLjEWMBQGA1UECxQNc2FuZGJveF9jZXJ0czEUMBIGA1UEAxQLc2FuZGJveF9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA4MDUwOTE2MzU1MlowIwYJKoZIhvcNAQkEMRYEFBn+YCVWaHPzrwo3JMGeCKhArtx3MA0GCSqGSIb3DQEBAQUABIGAZeZqhEywGh3nyRG87cCLlG35FqSoEUgWXbaKuhdeWzNWYWrADGHJFvRGCZwNofIrB8E64sdyWzCVNa2PK7OfviLXwnwfvXArS46t2SGJS9vtO3dR9HFehL1FYVOrvwrE5BEHPW+kypu33w+D+kG7dsMszk3E/2Gg2pdCM+WCQHc=-----END PKCS7-----'>"
+ "</form>";*/


	var express_form = "<b>Select your start-up payment.</b><br />You will be able to extend your account services when you reach the end of this period. We will notify you 15 days before your services are set to expire. You will be granted 30 days after expiration to reactivate your account. After 30 days we will be forced to remove your account and delete all files and data associated with the account."
			+ "<br />"
			+ "<br />"
	
			+ "<select id='payment_amount' onchange=''>"
			+ "<option value='6'>Online Gallery 6 Months - $60.00</option>"
			+ "<option value='12'>Online Gallery 1 Year - $110.00</option>"
			+ "<option value='24'>Online Gallery 2 Years - $210.00</option>"
			+ "</select>"
			+ "<br />"
			+ "<br />"
			+ "<input type='submit' class='button' onClick='submit_silver_payment()' value='next'/>";
		return express_form;
}

var free_signup_form = function () {
	var form = "<b>Please provide an email address and password. "
		+ "They will be used for logging in to your account.</b><br />"
        + "<br />email<br />"
        + "<input class=\"clean\" id=\"email\" type=\"\" /><br />"
        + "secret password<br />"
        + "<input class=\"clean\" id=\"password\" type=\"password\" /><br />"
        + "confirm password<br />"
        + "<input class=\"clean\" id=\"c_password\" type=\"password\" onkeypress=\"check_return(event,'submit_silver_signup()')\"/><br />"
        + "<input class=\"clean\" id=\"agree_box\" type=\"checkbox\" /> I have read and agree to the <a onClick=\"window.open('http://topfolios.com/terms.php')\">Terms of Use</a>.<br /><br />"
        + "<input class=\"button\" type=\"submit\" value=\"create\" onclick=\"submit_free_signup()\"/>";
		return form;
}

var jobs_signup_form = function () {
	var form = "email<br />"
        + "<input class=\"clean\" id=\"email\" type=\"\" /><br />"
        + "secret password<br />"
        + "<input class=\"clean\" id=\"password\" type=\"password\" /><br />"
        + "confirm password<br />"
        + "<input class=\"clean\" id=\"c_password\" type=\"password\" onkeypress=\"check_return(event,'submit_jobs_signup()')\"/><br />"
        + "<input class=\"clean\" id=\"agree_box\" type=\"checkbox\" /> I have read and agree to the <a onClick=\"window.open('http://topfolios.com/terms.php')\">Terms of Use</a>.<br /><br />"
        + "<input class=\"button\" type=\"submit\" value=\"create\" onclick=\"submit_jobs_signup()\"/>";
		return form;
}