﻿function countwords(ctrl) {
    try {
        var initValue = parseInt(document.getElementById("spnCounter").innerHTML);
        var str = document.getElementById(ctrl).value;
        if (initValue > 0) {
            var ctr = 0;
            if (str.trim() != "") {
                ctr = str.trim().split(" ").length;
            }
            ctr = 100 - ctr;
            document.getElementById("spnCounter").innerHTML = ctr;
        }
        else {

        }
    }
    catch (err) {
        //asdf
    }
}
function countwords2(ctrl) {
    try {
        var initValue = parseInt(document.getElementById("spnCounter2").innerHTML);
        var str = document.getElementById(ctrl).value;
        if (initValue > 0) {
            var ctr = 0;
            if (str.trim() != "") {
                ctr = str.trim().split(" ").length;
            }
            ctr = 100 - ctr;
            document.getElementById("spnCounter2").innerHTML = ctr;
        }
        else {

        }
    }
    catch (err) {
        //asdf
    }
}

function setHome()
  {
    if (document.all)
    {
     document.body.style.behavior='url(#default#homepage)';
     document.body.setHomePage('http://www.alwasat.com.kw/default.aspx');
    

    }
    else if (window.sidebar) {
         if(window.netscape)
         {
          try
          {
          netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
          }
       catch(e)
      {
    alert("this action is disabled by your browser，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage','http://www.alwasat.com.kw/default.aspx');
}
}

function submitSearch() {
    window.location = "/news/PPLSearch.aspx?keyword=" + document.getElementById("textfieldSearch").value;
}



  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21536872-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

