var _widget = {}; _widget.show_contact = true; //########################################################################################## //--> Begin Function :: Init function _init_seo_shortcut(){ //lets get the script tag var Scripts = document.getElementsByTagName("script"); //insert style var HeadTag = document.getElementsByTagName("head")[0]; if(HeadTag != null){ var its_random = new Date().getTime(); var Style = document.createElement("link"); Style.setAttribute("href", "http://www.submitawebsite.com/_widget.aspx?r=seo_shortcut_css&host=" + document.location.hostname + "&" + its_random + "=" + its_random); Style.setAttribute("rel", "stylesheet"); Style.setAttribute("type", "text/css"); HeadTag.appendChild(Style); } //loop through until we find it for( var i = 0; i < Scripts.length; i++) { if(Scripts[i].getAttribute("src") == "http://www.submitawebsite.com/_widget.aspx?r=seo_shortcut"){ _widget.js_container = Scripts[i]; break; } } //create new container and set div var Container = document.createElement("div"); Container.setAttribute("id", "_seoshortcutwidget"); //replace javascript node with div _widget.js_container.parentNode.replaceChild(Container, _widget.js_container); //get widget container _widget.container = document.getElementById("_seoshortcutwidget"); //setup gui var Header = "(Hide)"; var Body = GetSEOShortcutGUI(); var Footer = GetFooterGUI(); _widget.container.innerHTML = GetGUI(Header, Body, Footer); } //--> End Function :: Init //########################################################################################## //--> Begin Function :: SubmitData function SubmitData(){ var Data = {}; Data["name_first"] = document.$("_widget_name_first").value; Data["name_last"] = document.$("_widget_name_last").value; Data["email"] = document.$("_widget_email").value; Data["phone"] = document.$("_widget_phone").value; Data["url"] = document.$("domain_name").value; Data["comment"] = "widget install domain:"+ document.location.hostname; Data["source_id"] = "116"; //begin prepare data var PostDataArray = new Array(); for(Item in Data){ PostDataArray.push(Item +"="+ Data[Item]); } var PostData = PostDataArray.join("&"); //end prepare data var HeadTag = document.getElementsByTagName("head")[0]; var its_random = new Date().getTime(); var Style = document.createElement("link"); Style.setAttribute("href", "http://www.submitawebsite.com/seo-tools/submit.aspx?"+PostData+"&" + its_random + "=" + its_random); Style.setAttribute("rel", "stylesheet"); Style.setAttribute("type", "text/css"); Style.setAttribute("id", its_random); HeadTag.appendChild(Style); //remove it var ThisElement = document.getElementById(its_random); ThisElement.parentNode.removeChild(ThisElement); ActivateShortcuts(); } //--> End Function :: SubmitData //########################################################################################## //--> Begin Function :: ShowHideCodeSnippet function ShowHideCodeSnippet(){ var SnippetContainer = document.getElementById("_widget_snippet"); if(SnippetContainer.style.display == "none"){ SnippetContainer.style.display = ""; }else{ SnippetContainer.style.display = "none"; } } //--> End Function :: ShowHideCodeSnippet //########################################################################################## //--> Begin Function :: ShowHideWidget function ShowHideWidget(){ var ShowHideButton = document.getElementById("show_hide_widget"); var WidgetControl = document.getElementById("_widget_control"); if(WidgetControl.style.display == "none"){ WidgetControl.style.display = ""; ShowHideButton.innerHTML = "(Hide)"; }else{ WidgetControl.style.display = "none"; ShowHideButton.innerHTML = "(Show)"; } } //--> End Function :: ShowHideWidget //########################################################################################## //--> Begin Function :: ActivateShortcuts //create the activate shortcuts function function ActivateShortcuts() { document.getElementById("_seoshortcutwidget").style.visibility = "inherit"; if(document.getElementById("_widget_contact_form")){ document.getElementById("_widget_contact_form").style.display = "none"; } //show contact form _widget.show_contact = false; var ResultsDiv = document.getElementById("_widget_results"); ResultsDiv.style.display = ""; //set the domain document.getElementById("domain_label").innerHTML = "http://"+document.getElementById("domain_name").value; document.getElementById("shortcut_label").innerHTML = "*choose shortcut above*"; //clear the frame document.getElementById("main_frame").src = "http://"+ document.getElementById("domain_name").value; //reset drop downs var DropDowns = document.getElementsByTagName("select"); for(var i = 0 ; i < DropDowns.length ; i++) { DropDowns[i].selectedIndex = 0; } } //--> End Function :: ActivateShortcuts //########################################################################################## //--> Begin Function :: RunShortcut //create the run shorcut function function RunShortcut(ddElement) { var DomainName = document.getElementById("domain_name").value.replace("http://",""); if(ddElement.selectedIndex != 0) { switch(ddElement.options[ddElement.selectedIndex].text){ /****************************************/ case "IP/DNS/Registrar Lookup": DomainName = DomainName.replace("http://",""); window.open(ddElement.value.replace("%URL%", DomainName)); return; break; /****************************************/ case "DMOZ Listings": document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName.replace("www.","")); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; return; break; /****************************************/ case "Yahoo! Pages Indexed": document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; return; break; /****************************************/ case "Yahoo! Directory Indexed": document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; return; break; /****************************************/ case "Yahoo! Backlinks": DomainName = DomainName.replace("http://",""); document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; return; break; /****************************************/ case "IP/DNS/Registrar Lookup": DomainName = DomainName.replace("http://",""); document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; return; break; /****************************************/ default: document.getElementById("main_frame").src = ddElement.value.replace("%URL%", DomainName); document.getElementById("shortcut_label").innerHTML = ddElement.options[ddElement.selectedIndex].text; break; } } } //--> End Function :: RunShortcut //########################################################################################## //--> Begin Function :: ShowContactGUI function ShowContactGUI(){ //check for empty domain if(document.getElementById("domain_name").value == "") { alert("Please supply a domain name."); return; } //was contact form already shown? if(_widget.show_contact == false){ ActivateShortcuts(); return; } var ContactDiv = document.createElement("div"); ContactDiv.setAttribute("id", "_widget_contact_form"); document.body.appendChild(ContactDiv); //alert(GetWidgetLeft() +"|"+ (GetWidgetTop())); //set contact div properties ContactDiv = document.getElementById("_widget_contact_form"); ContactDiv.style.top = (GetWidgetTop()) +"px"; ContactDiv.style.left = (GetWidgetLeft()) +"px"; ContactDiv.style.height = (GetWidgetHeight()) +"px"; ContactDiv.style.width = (GetWidgetWidth() - 200) +"px"; ContactDiv.style.position = "absolute"; var Contents; Contents = ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += ''; Contents += '
Please enter contact information:
First Name:
Last Name:
Phone Number:
Your E-mail Address
'; //set content ContactDiv.innerHTML = Contents; //hide widget document.getElementById("_seoshortcutwidget").style.visibility="hidden"; } //--> End Function :: ShowContactGUI //########################################################################################## //--> Begin Function :: GetGUI function GetGUI(Header, Body, Footer){ var GUI = Array(); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push('
' + Header + '
' + Body + '
'); return GUI.join("\n"); } //--> End Function :: GetGUI //########################################################################################## //--> Begin Function :: GetFooterGUI function GetFooterGUI(){ var GUI = Array(); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push('
'); GUI.push(''); GUI.push(''); GUI.push('Get This Tool!'); GUI.push('
'); GUI.push(''); return GUI.join(""); } //--> End Function :: GetFooterGUI //########################################################################################## //--> Begin Function :: GetSEOShortcutGUI function GetSEOShortcutGUI(){ var GUI = Array(); GUI.push('
'); GUI.push('
'); GUI.push('

Please enter your URL: '); GUI.push(''); GUI.push(''); GUI.push(''); GUI.push('(Note: include "www" if applicable)

'); GUI.push(''); GUI.push('
'); return GUI.join("\n"); } //--> End Function :: GetSEOShortcutGUI //########################################################################################## //--> Begin Function :: GetCodeSnippet function GetCodeSnippet(){ var Code = ""; Code += "
Powered by Web.com | Search Agency, the Search Engine Optimization Company
"; return Code; } //--> End Function :: GetCodeSnippet //########################################################################################## //--> Begin Method :: GetWidgetTop //this method returns the top coordinate for an element function GetWidgetTop() { var element = document.getElementById("_seoshortcutwidget"); var elementTop = 0; elementTop = element.offsetTop; var ParentElement = element.offsetParent; while(ParentElement != null) { elementTop += ParentElement.offsetTop; ParentElement = ParentElement.offsetParent; } return elementTop; }; //<-- End Method :: GetWidgetTop //########################################################################################## //--> Begin Method :: GetWidgetLeft //this method returns the left coordinate for an element function GetWidgetLeft() { var element = document.getElementById("_seoshortcutwidget"); var elementLeft = 0; elementLeft = element.offsetLeft; var ParentElement = element.offsetParent; while(ParentElement != null) { elementLeft += ParentElement.offsetLeft; ParentElement = ParentElement.offsetParent; } return elementLeft; }; //<-- End Method :: GetWidgetLeft //########################################################################################## //--> Begin Method :: GetWidgetHeight //this method returns the height of a rendered element function GetWidgetHeight() { var element = document.getElementById("_seoshortcutwidget"); var elementHeight = 0; if(element.offsetHeight) { elementHeight = element.offsetHeight; } else if(element.clip && element.clip.height) { elementHeight = element.clip.height; } else if(element.style && element.style.pixelHeight) { elementHeight = element.style.pixelHeight; } return parseInt(elementHeight); }; //<-- End Method :: GetWidgetHeight //########################################################################################## //--> Begin Method :: GetWidgetWidth //this method returns the width of a rendered element function GetWidgetWidth() { var element = document.getElementById("_seoshortcutwidget"); var elementWidth = 0; if(element.offsetWidth) { elementWidth = element.offsetWidth; } else if(element.clip && element.clip.width) { elementWidth = element.clip.width; } else if(element.style && element.style.pixelWidth) { elementWidth = element.style.pixelWidth; } return parseInt(elementWidth); }; //<-- End Method :: GetWidgetWidth //########################################################################################## //initialize _init_seo_shortcut();