var domainprefix = '';

function go() {
if(document.getElementById("theword").value == ""){
        return false;
}
    location.href="http://" + domainprefix + "word.sc/" + document.getElementById("theword").value;
    return false;
}

function go2() {
if(document.getElementById("theword").value == ""){
	location.href="http://"+domainprefix+"word.sc/";
        return false;
}
    location.href="http://"+domainprefix+"word.sc/" + document.getElementById("theword").value;
    return false;
}

function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
	node = document;
    if ( tag == null )
	tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (i=0,j=0;i<els.length;i++) {
	if ( pattern.test(els[i].className) ) {
	    classElements[j] = els[i];
	    j++;
	}
    }
    return classElements;
}

function ajax(ajaxid){
    //var f=$(ajaxid);
    var f=document.getElementById(ajaxid);
    f.style.display=(f.style.display=='block'?'none':'block');
    void 0;
}

function ajaxclass(ajaxid){
    var elements = getElementsByClass(ajaxid);
    for ( var i = elements.length-1; i>=0; --i ) {
	
	elements[i].style.display = (elements[i].style.display=='list-item'?'none':'list-item');
    }
    
    var showtag = document.getElementById(ajaxid);
    if(showtag.innerHTML == "Show all definitions..."){
	showtag.innerHTML = "Show less definitions...";
    }
    else{
	showtag.innerHTML = "Show all definitions...";
    }
    void 0;
}

function highlight(pos) {
    window.location.hash='_'+pos;

    document.getElementById(pos).style.background = '#ffffe0';
    document.getElementById(pos).style.border = '1px solid #fcc90d';
    setTimeout("document.getElementById('" + pos + "').style.background = '#FFFFFF'", 3000);
    setTimeout("document.getElementById('" + pos + "').style.border = 'none'", 3000);

}

function thes() {
if(document.getElementById("theword").value == ""){
	return false;
}
    location.href="http://"+domainprefix+"word.sc/thes/" + document.getElementById("theword").value;
    return false;
}

function thes2() {
if(document.getElementById("theword").value == ""){
	location.href="http://"+domainprefix+"word.sc/?thes";
        return false;
}
    location.href="http://"+domainprefix+"word.sc/thes/" + document.getElementById("theword").value;
    return false;
}

function zoom(){
    if(document.getElementById('maincontent').style.fontSize == "20px"){
	document.getElementById('maincontent').style.fontSize = "13px";
    }
    else if(document.getElementById('maincontent').style.fontSize == "17px"){
	document.getElementById('maincontent').style.fontSize = "20px";
    }
    else{
	document.getElementById('maincontent').style.fontSize = "17px";
    }
}

function ratepos(){
    document.getElementById('rate').innerHTML="I like this word!";
    document.getElementById('rate').style.color = "green";
}

function rateneg(){
    document.getElementById('rate').innerHTML="I dislike this word!";
    document.getElementById('rate').style.color = "red";
}

function rateout(current){
    if(current == 1) {
        document.getElementById('rate').innerHTML="You like this word.";
        document.getElementById('rate').style.color = "green";
    }
    else if(current == 0) {
        document.getElementById('rate').innerHTML="You dislike this word.";
        document.getElementById('rate').style.color = "red";
    }
    else {
        document.getElementById('rate').innerHTML="";
        document.getElementById('rate').style.color = "";
    }
}

function printit(){  
    if (window.print) {
	window.print() ;  
    } else {
	var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
	WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";
    }
}

var minimum = 4; 
var fair = 6; 
var strength_label = Array( 'Too short', 'Weak', 'Fair', 'Medium', 'Strong', 'Very Strong' ); 
var strength_color = Array( 'FF0000', 'FF9900', 'FFCC33', '99CC99', '00CC33', '006600' ); 
var strength_width = Array( '10', '20', '30', '50', '75', '100' ); 
function updatestrength( pw ) { 
if(!pw){ var pw = document.getElementById('password').value.toString(); } 
if(!pw){ return false; } 
var strength = 0; 
if( pw.length >= minimum ) { 
strength = 1; 
if(pw.length >= fair){ 
strength++; 
} 
if(/\d+/.test(pw)){ 
strength++; 
} 
if(/\W+/.test(pw)){ 
strength++; 
} 
if(/[a-z]+/.test(pw) && /[A-Z]+/.test(pw)){ 
strength++; 
} 
} 
document.getElementById('strength').innerHTML = strength_label[ strength ] + ' ' + strength; 
document.getElementById('strengthbar').style.backgroundColor = '#'+strength_color[ strength ]; 
document.getElementById('strengthbar').style.width = strength_width[ strength ]+'%'; 
} 

function ValidatePassword(fld1, fld2) {
   var checker = document.getElementById('validation');
   if (fld1.value.length == 0 && fld2.value.length ==0) {
        fld1.style.border = "1px solid black";
        fld2.style.border = "1px solid black";
        checker.innerHTML = "";
        return;
   }
   if (fld1.value.length == fld2.value.length) {
       if (fld1.value.match(fld2.value) != null) {
       	fld1.style.border = "2px solid green";
       	fld2.style.border = "2px solid green";
       	checker.innerHTML = "Passwords Match!";
       	return;
       }
     }
fld1.style.border = "1px solid black";
fld2.style.border = "1px solid black";

   checker.innerHTML = "";
}

function installSearchEngine() {
   if (window.external && ("AddSearchProvider" in window.external)) {
      // Firefox 2 and IE 7, OpenSearch
      window.external.AddSearchProvider("http://word.sc/qry/search/wordscsearch-os.src");
   } else if (window.sidebar && ("addSearchEngine" in window.sidebar)) {
      // Firefox <= 1.5, Sherlock
      window.sidebar.addSearchEngine("http://word.sc/qry/search/wordscsearch.src", "http://word.sc/qry/search/wordscsearch.gif","Word Source", "Fast, easy, and interactive Dictionary, Thesaurus, and more");
   } else {
      // No search engine support (IE 6, Opera, etc).
      alert("No search engine support");
   }
}


