function searchLeave() {
	if(document.searcher.q.value == '') { document.searcher.q.value='Search IAS Training'}
}

function searchSelect() {
	if (document.searcher.q.value == 'Search IAS Training') {document.searcher.q.value=''}
}

//Check URL
function getQueryVariable(varToFind) {
    var query = window.location.search.substring(1);
    var vars = query.split("?");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == varToFind) {
            if(vars[1] != undefined) {
                var newString = vars[0] + vars[1];
                var finalURL = newString.slice(varToFind.length+1);
                return finalURL;
            }
            else {
                var newString = vars[0];
                var finalURL = newString.slice(varToFind.length+1);
                return finalURL;
                }
        }
    }
}

var selection = getQueryVariable("blog");

function blogSubmitted() {
  if (selection == "submitted"){
        document.getElementById("blog-message").style.display="";
	    document.getElementById("blog-message").innerHTML="<p class='blogFeeds'>Thank you! Your email address has been recorded. Look for the next Sales Insight Blog Post in your email inbox.</p>";
        document.getElementById("blog-container").style.display="none";
        document.getElementById("blog-form").style.display="none";
	}
	
      else {
       
	  }
}


function validate(blog,blogEmail) {
   var ck_email = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var email_address = document.forms[blog].elements[blogEmail].value;
   if(ck_email.test(email_address) == false) {
      document.getElementById("blog-container").innerHTML="<p class='blogFeeds' style='color: red'>You have entered and invalid email address. Please try entering your email address again:</p>";      
      return false;
   }
   else {
   return true;
   }
}

function blogmsg() {
   document.blog.action="http://www.iastraining.com/send_blog.asp";
}

function printContent(id){
str=document.getElementById(id).innerHTML
newwin=window.open('','printwin','left=100,top=100,scrollbars=1,width=800,height=600')
newwin.document.write('<HTML>\n<HEAD>\n')
newwin.document.write('<TITLE>IAS Taining | Sales Insight Blog by Brad Huisken</TITLE>\n')
newwin.document.write('<style media="screen" type="text/css">@import url("http://www.iastraining.com/style/blog_pg_hdr_ftr.css");@import url("http://www.iastraining.com/style/blog_body.css");</style>\n')
newwin.document.write('<style type="text/css">div.print{display:none;}p.post-footer{display:none;}h2.date-header{display:none;}a.blogger{display:none;}</style>\n')
newwin.document.write('<script>\n')
newwin.document.write('function chkstate(){\n')
newwin.document.write('if(document.readyState=="complete"){\n')
newwin.document.write('window.close()\n')
newwin.document.write('}\n')
newwin.document.write('else{\n')
newwin.document.write('setTimeout("chkstate()",2000)\n')
newwin.document.write('}\n')
newwin.document.write('}\n')
newwin.document.write('function print_win(){\n')
newwin.document.write('window.print();\n')
newwin.document.write('chkstate();\n')
newwin.document.write('}\n')
newwin.document.write('<\/script>\n')
newwin.document.write('</HEAD>\n')
newwin.document.write('<BODY onload="print_win()">\n')
newwin.document.write(str)
newwin.document.write('<div id="footerBottomLt"><p class="left">&copy; 1996 - 2011, IAS Training<br />6655 West Jewell Avenue, Lakewood, CO 80232<br /><strong>ph:</strong> 303.936.9353 | 800.248.7703 | <strong>fax:</strong> 303.936.9581 | <strong>e:</strong> <a href="mailto:info@iastraining.com?subject=iastraining.com%20Website%20Inquiry">info@iastraining.com</a></p></div>\n')
newwin.document.write('</BODY>\n')
newwin.document.write('</HTML>\n')
newwin.document.close()
}
