var _SAFESIGNED_cert_type = 244; var _SAFESIGNED_certificate = 6540 var _SAFESIGNED_sb_logo = ''; var _SAFESIGNED_scripts = document.getElementsByTagName("script"); var _SAFESIGNED_count = _SAFESIGNED_scripts.length; if (typeof _SAFESIGNED_refresh_page !== 'function' ) { function _SAFESIGNED_refresh_page() { setTimeout("location.reload(true);", 3600000); } _SAFESIGNED_refresh_page(); } while (_SAFESIGNED_count > 0) { _SAFESIGNED_count--; var _SAFESIGNED_curr_script = _SAFESIGNED_scripts[_SAFESIGNED_count]; var _SAFESIGNED_script = "https://verify.safesigned.com/seal/" + _SAFESIGNED_cert_type + '/' + _SAFESIGNED_certificate; if (_SAFESIGNED_curr_script.src == _SAFESIGNED_script) { //add seal CSS (Note: we can override the _SAFESIGNED_ variable with no harm, because the script object it //used to reference has already been inserted into the
section of the page) _SAFESIGNED_css = document.createElement('link'); _SAFESIGNED_css.rel = "stylesheet"; _SAFESIGNED_css.type = "text/css"; _SAFESIGNED_css.href = "https://verify.safesigned.com/static/api/seal_css.css"; //TODO: append only if it does not exist yet //TODO: simply add snippet to loadSeal method? document.getElementsByTagName('head')[0].appendChild(_SAFESIGNED_css); //execute code for triggering seal loading eval(_SAFESIGNED_curr_script.innerHTML); break; } } /* this version of the script is meant for displaying ALL types of seals (external seals currently excluded) and should be coupled with a code which loads seals ASYNCHRONOUSLY */ function SEAL(cert_type_id, cert_id, seal_shape, text_id) { text_id = typeof text_id !== 'undefined' ? text_id : 'none'; this.text_id = text_id; this.cert_id = cert_id; this.cert_type_id = cert_type_id; this.seal_shape = seal_shape; //1 - notary, 2 - tab, 4 - rectangle, 5 - classic this.base_url = "https://verify.safesigned.com/"; this.var_name = 'SEAL_CONTAINER_' + this.cert_type_id; //CON instance variable name this.t_AR = 1200; //seal automatic reload time in seconds (after the seal has been loaded) this.t_SL = 2000; //spinner "loading" time in miliseconds //determine current page url (TODO: move this to function A() because you trigger security exception there //again anyway (to check loading in iframe etc) try { this.p_url = window.top.location.href; //we need to get topmost location (just in case if page uses frames) this.r_url = window.top.document.referrer; //referring url ... needed only for statistics } catch (ex) { //security exception... seal is loaded on a page which is open in a frame on another domain this.p_url = window.location.href; //save current page url, although it won't be used, because //it is open in a frame on another domain this.r_url = ''; } this.loadSeal = function() { this.c_name = 'safesigned_seal_' + this.cert_type_id //seal container name this.c_div = document.getElementById(this.c_name); //container div this.A(); //create script request link and insert it into section (and load it this way) //TODO: load CSS here if not yet included? }; //generates a link to the seal displaying script and inserts this link into the head //section of the page so that the script is retrieved and executed this.A = function() { var CON_objHead = document.getElementsByTagName("head")[0]; var CON_objScript = document.createElement("script"); CON_objScript.type = 'text/javascript'; var CON_mode = location.protocol; var CON_isSecure = (CON_mode == 'https:') ? 1 : 0; var parts = this.r_url.split('/', 3); var ref_domain = (parts.length < 3) ? '' : parts[2]; var cookies = document.cookie.split(';'), name = 'safesigned_ct=', //cookie name token = 'F0F0'; for (var i = 0; i < cookies.length; i++) { var c = cookies[i]; while (c.charAt(0) == ' ') { c = c.substring(1, c.length); } if (c.indexOf(name) === 0) { token = c.substring(name.length, c.length); } } //generate a link to request the seal var seal_req_link = this.base_url + "seal_loader/" + this.cert_type_id + '/' + this.cert_id + '/?' + 'secure=' + CON_isSecure + '&p_url=' + escape(this.p_url) + '&token=' + token + '&s_shape=' + this.seal_shape + '&ref_d=' + escape(ref_domain) + '&text_id=' + this.text_id + '&' + Math.floor(Math.random()*999999999999); try { var dummy = window.top.document; //trigger security exception if page is loaded in an iframe on another domain } catch (ex) { //create invalid script link that will result in a NOT VERIFIED seal //-6 for p_url is our special error code which indicates that a security exception was triggered seal_req_link = this.base_url + "seal_loader/" + this.cert_type_id + '/' + this.cert_id + '/?' + 'secure=' + CON_isSecure + '&p_url=-6' + '&s_shape=' + this.seal_shape + '&ref_d=' + '&' + Math.floor(Math.random()*999999999999); } CON_objScript.src = seal_req_link; CON_objHead.appendChild(CON_objScript); window.setTimeout(this.var_name + '.A();', (this.t_AR * 1000)); //set automatic seal reload time }; //generate classic seal this.gen_seal_cls = function(cert_link, seal_img_url, signature) { //if signature is not provided (undefined), this means we have tech. issues or "not verified" case //if signature IS provided (even if it is an empty string) var use_bubble = (signature === ""); //empty string (NOTE: undefined does not count!) var show_sig = signature ? true : false; var toggle_code = ""; if (use_bubble) { //create mouseover and mouseout code for toggling the signature bubble logo var bubble_id = "sig_bubble_" + this.cert_type_id; var code_mover = [this.var_name, ".sig_bubble_pre_toggle('", bubble_id, "', true);"].join(""); var code_mout = [this.var_name + ".sig_bubble_pre_toggle('", bubble_id, "', false);"].join(""); toggle_code = ["onmouseover=\"", code_mover, "\" onmouseout=\"", code_mout, "\""].join(""); } var seal_html = ['']; if (show_sig) { var sig = ['']; seal_html.push.apply(seal_html, sig); } this.c_div.innerHTML = seal_html.join(""); //add seal to container //now that the seal image exists, create its signature bubble if necessary if (use_bubble) { var sig_bubble = document.getElementById(bubble_id); if (!sig_bubble) { //if signature bubble does not yet exist ... sig_bubble = document.createElement("div"); sig_bubble.id = bubble_id; sig_bubble.onmouseover = function() { eval(code_mover); }; sig_bubble.onmouseout = function() { eval(code_mout); }; sig_bubble.innerHTML = ['