$(document).ready(function(){	
	var aboutSslText = new Object();
	var SslLink = new Object();
		
	aboutSslText["hr"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["da"] = "Om SSL-certifikater";
	aboutSslText["nl"] = "Informatie over SSL-certificaten";
	aboutSslText["en"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["fi"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["fr"] = "&#192; propos des certificats SSL";
	aboutSslText["de"] = "&#220;ber SSL-Zertifikate";
	aboutSslText["is"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["it"] = "Informazioni sui certificati SSL";
	aboutSslText["ja"] = "SSL&#12395;&#12388;&#12356;&#12390;";
	aboutSslText["ko"] = "SSL &#51064;&#51613;&#49436; &#51221;&#48372;";
	aboutSslText["no"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["pl"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["sl"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["pt"] = "Sobre certificados SSL";
	aboutSslText["br"] = "ABOUT SSL CERTIFICATES";
	aboutSslText["es"] = "Acerca de los certificados SSL";
	aboutSslText["sv"] = "Om SSL-certifikat";
		
	SslLink["hr"] = "http://www.thawte.com/products/";
	SslLink["da"] = "http://www.thawte.com/products/";
	SslLink["nl"] = "http://www.thawte.com/products/";
	SslLink["en"] = "http://www.thawte.com/products/";
	SslLink["fi"] = "http://www.thawte.com/products/";
	SslLink["fr"] = "http://www.thawte.com/products/";
	SslLink["de"] = "http://www.thawte.com/products/";
	SslLink["is"] = "http://www.thawte.com/products/";
	SslLink["it"] = "http://www.thawte.com/products/";
	SslLink["ja"] = "http://www.thawte.com/products/";
	SslLink["ko"] = "http://www.thawte.com/products/";
	SslLink["no"] = "http://www.thawte.com/products/";
	SslLink["pl"] = "http://www.thawte.com/products/";
	SslLink["br"] = "http://www.thawte.com/products/";
	SslLink["sl"] = "http://www.thawte.com/products/";
	SslLink["pt"] = "http://www.thawte.com/products/";
	SslLink["es"] = "http://www.thawte.com/products/";
	SslLink["sv"] = "http://www.thawte.com/products/";
	
	
	$("#sel_copy").click(function(){
		$("#seal_code").focus().select();
		return false;
	});
	
	$("#cscript_btn").click(function() {
		var host = $("#common_name").val(),
			size = $(".seal_size:radio:checked").val(),
			language = $("#seal_lang").val(),
			useflash = $("#seal_format").val(),
			pickup_code,
			badhost = "Please enter the common name.\nThe common name must match the \ncommon name (CN) on the SSL Certificate.";
		
		$("#seal_code").val("");
		
		//Verify that common name is not null
		if ((host==null)||(host=="")) {
		  alert(badhost);
		  return false;
		}
		
		//Verify that there are no consecutive periods in common name
		if (host.indexOf('..') > -1) {
		  alert(badhost);
		  return false;
		}
		
		var host2 = host.split(".");
		if (host2.length < 2) {
		  alert(badhost);
		  return false;
		}
		
		for (var i=0; i<host2.length; i++) {
		  if (host2[i].length < 1) {
		     alert(badhost);
		     return false;
		  }
		}
		
		pickup_code = '<script type="text/javascript" src="https://seal.thawte.com/getthawteseal?host_name=';
		pickup_code += host;
		pickup_code += "&amp;size=" +  size;
		pickup_code += "&amp;lang=" + language;
		pickup_code += '"><\/script>';
		
		if ($("#agree_toc:checked").length > 0)
			if ($("#seal_layout option:selected").val() == "layout1") {
				$("#seal_code").val('<div id=\"thawteseal\" style=\"text-align:center;\" title=\"Click to Verify - This site chose Thawte SSL for secure e-commerce and confidential communications.\">\n<div>' + pickup_code + '</div>\n<div><a href=\"' + SslLink[language] + '\" target=\"_blank\" style=\"color:#000000; text-decoration:none; font:bold 10px arial,sans-serif; margin:0px; padding:0px;\">' + aboutSslText[language] + '</a></div>\n</div>');
			}
			else if ($("#seal_layout option:selected").val() == "layout2") {
				$("#seal_code").val(pickup_code);
			}
			else {
				alert("Please select a layout");
			}
		else {
			alert("Please read and accept the Conditions of Use first");
		}
		
		return false;
	});
	
	


});
