// <![CDATA[
// rollover script
//
function rollover( e ){
var img_src = e.childNodes[0].src ;
var img_split = img_src.split("_off") ;

if ( img_split.length == 1 ){
img_split = img_src.split("_on") ;
e.childNodes[0].src = img_split[0] + '_off' + img_split[1] ;
}else{
e.childNodes[0].src = img_split[0] + '_on' + img_split[1] ;
}}

function hideBlock(id){
document.getElementById(id).style.display='none';
}

function showBlock(id){
document.getElementById(id).style.display='block';
}


function togglePhone(){
var contact_method = document.form1.contact_method.value;
if(contact_method == 'Phone'){
showBlock('phone_block');
}else{
hideBlock('phone_block');
}}

function toggleReferMessage(){
var refer = document.form1.refer.value;
if(refer == 'Other'){
showBlock('refer_message_block');
}else{
hideBlock('refer_message_block');
}}




////////////////////
// start email verify...
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if(str.indexOf(at)==-1){
return false
}
if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return false
}
if(str.indexOf(dot)==-1 || str.indexOf(dot)==0 || 
str.indexOf(dot)==lstr){
return false
}
if(str.indexOf(at,(lat+1))!=-1){
return false
}
if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false
}
if(str.indexOf(dot,(lat+2))==-1){
return false
}
if(str.indexOf(" ")!=-1){
return false
}
return true
}
// end email verify...
////////////////////

////////////////////
// start phone verify...
function CheckPhoneNumber(TheNumber) {
var valid = 1
var GoodChars = "0123456789()-+ "
var i = 0
if (TheNumber=="") {
// Return false if number is empty
valid = 0
}
for (i =0; i <= TheNumber.length -1; i++) {
if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
valid = 0
} // End if statement
} // End for loop
return valid
}
// end phone verify...
////////////////////

////////////////////
// start clearMsgForm()
function clearMsgForm(){
var msg = document.getElementById('message').value;
if(msg == 'Type your message here...'){
document.getElementById('message').value = '';
}}
// end clearMsgForm()
////////////////////

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=443,height=500,left = 290.5,top = 134');");
}

function liveHelpLogin(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=375,height=425,left = 290.5,top = 134');");
}



////////////////////
// START verifyContactForm()
function verifyContactForm(){
error = 0;

var name = document.form1.name.value;
var email = document.form1.email.value;
var cap = document.form1.cap.value;
var message = document.form1.message.value;

document.getElementById('validate1').style.display='none';
document.getElementById('validate2').style.display='none';
document.getElementById('validate3').style.display='none';
document.getElementById('validate4').style.display='none';

if(name == "" || name == null){
document.getElementById('validate1').style.display='block';
error = 1;
}

if ((echeck(email)==false) || email == "" || email == null){
document.getElementById('validate2').style.display='block';
error = 1;
}

if(cap == "" || cap == null){
document.getElementById('validate3').style.display='block';
error = 1;
}

if(message == "" || message == null || message == 'Type your message here...'){
document.getElementById('validate4').style.display='block';
error = 1;
}

if(error){
return false;
}else{
return true;
}}
// DONE WITH verifyContactForm()
////////////////////

////////////////////
// START verifyQuoteForm()
function verifyQuoteForm(){
error = 0;
errorMessage = "Please correct the following errors:\r\n\r\n";

var name = document.form1.name.value;
var email = document.form1.email.value;
var contact_method = document.form1.contact_method.value;
var phone = document.form1.phone.value;
var cap = document.form1.cap.value;
var message = document.form1.message.value;

document.getElementById('validate1').style.display='none'; //name
document.getElementById('validate2').style.display='none'; //email
document.getElementById('validate3').style.display='none'; //phone (if Phone)
document.getElementById('validate5').style.display='none'; //message
document.getElementById('validate6').style.display='none'; //cap


if(name == "" || name == null){
document.getElementById('validate1').style.display='block';
errorMessage += "* Please enter your contact name.\r\n";
error = 1;
}

if ((echeck(email)==false) || email == "" || email == null){
document.getElementById('validate2').style.display='block';
errorMessage += "* Your email address appears to be invalid.\r\n";
error = 1;
}

if(contact_method == 'Phone'){
if((!CheckPhoneNumber(phone)) || phone == "" || phone == null){
document.getElementById('validate3').style.display='block';
errorMessage += "* Please enter your contact phone number.\r\n";
error = 1;
}}


if(message == "" || message == null || message == 'Type your message here...'){
document.getElementById('validate5').style.display='block';
errorMessage += "* Please enter a brief project description.\r\n";
error = 1;
}

if(cap == "" || cap == null){
document.getElementById('validate6').style.display='block';
errorMessage += "* Please enter the human validation code exactly as it appears on the page.\r\n";
error = 1;
}

if(error){
document.form1.name.focus();
alert(errorMessage);
return false;
}else{
return true;
}}
// DONE WITH verifyQuoteForm()
////////////////////

////////////////////
// START verifyDomainNameCheck()
function verifyDomainNameCheck() {
error = 0;
var domain =  document.getElementById('domain').value;
document.getElementById('validate1').style.display='none';

if(domain == "" || domain == null){
document.getElementById('validate1').style.display='block';
error = 1;
}

if(error){
document.form1.domain.focus();
return false;
}else{
return true;
}}
// DONE WITH verifyDomainNameCheck()
////////////////////

////////////////////
// START verifyDomainRegistrationForm()
function verifyDomainRegistrationForm() {
error = 0;
errorMessage = "Please correct the following errors:\r\n\r\n";

var state = document.form1.state.value;
var first_name = document.form1.first_name.value;
var last_name = document.form1.last_name.value;
var phone = document.form1.phone.value;
var email = document.form1.email.value;
var street_address_1 = document.form1.street_address_1.value;
var city = document.form1.city.value;
var zip = document.form1.zip.value;
var cap = document.form1.cap.value;
var verify = document.form1.verify;

document.getElementById('validate1').style.display='none'; //first_name
document.getElementById('validate2').style.display='none'; //last_Name
document.getElementById('validate3').style.display='none'; //phone
document.getElementById('validate4').style.display='none'; //email
document.getElementById('validate5').style.display='none'; //street_address_1
document.getElementById('validate6').style.display='none'; //city
document.getElementById('validate7').style.display='none'; //state
document.getElementById('validate8').style.display='none'; //zip
document.getElementById('validate9').style.display='none'; //cap
document.getElementById('validate10').style.display='none'; //verify

if(verify.checked != true){
document.getElementById('validate10').style.display='block';
errorMessage += "* You must agree to our Terms of Service.\r\n";
error = 1;
}


if(first_name == "" || first_name == null){
document.getElementById('validate1').style.display='block';
errorMessage += "* Please enter your first name.\r\n";
error = 1;
}

if(last_name == "" || last_name == null){
document.getElementById('validate2').style.display='block';
errorMessage += "* Please enter your last name.\r\n";
error = 1;
}

if((!CheckPhoneNumber(phone)) || phone == "" || phone == null){
document.getElementById('validate3').style.display='block';
errorMessage += "* Please enter your contact phone number.\r\n";
error = 1;
}

if ((echeck(email)==false) || email == "" || email == null){
document.getElementById('validate4').style.display='block';
errorMessage += "* Your billing email address appears to be invalid.\r\n";
error = 1;
}

if(street_address_1 == "" || street_address_1 == null){
document.getElementById('validate5').style.display='block';
errorMessage += "* Please enter your billing street address.\r\n";
error = 1;
}

if(city == "" || city == null){
document.getElementById('validate6').style.display='block';
errorMessage += "* Please enter your billing city.\r\n";
error = 1;
}


if(state == "" || state == null || state == 'Please Select'){
document.getElementById('validate7').style.display='block';
errorMessage += "* Please select your state.\r\n";
error = 1;
}

if(zip == "" || zip == null){
document.getElementById('validate8').style.display='block';
errorMessage += "* Please select your zip code.\r\n";
error = 1;
}


if(cap == "" || cap == null){
document.getElementById('validate9').style.display='block';
errorMessage += "* Human  validation code missing or incorrect..\r\n";
error = 1;
}

if(error){
document.form1.first_name.focus();
alert(errorMessage);
return false;
}else{
return true;
}}
// DONE WITH verifyDomainRegistrationForm()
////////////////////


function legal() {
  var win = new Window({id: "legal", className: "spread", title: "Privacy &amp; Legal", width:475, height:450});
  win.setURL('../legal.html#legal')
  win.setDestroyOnClose(); 
  win.showCenter();
  win.setConstraint(true, {left:0, right:0, top: 25, bottom:0})
  win.toFront();
}

function privacy() {
  var win = new Window({id: "privacy", className: "spread", title: "&nbsp;", width:475, height:450});
  win.setURL('../legal.html#top')
  win.setDestroyOnClose(); 
  win.showCenter();
  win.setConstraint(true, {left:0, right:0, top: 25, bottom:0})
  win.toFront();
}


function domain_agreement() {
  var win = new Window({id: "agreement", className: "spread", title: "&nbsp;", width:475, height:450});
  win.setURL('../agreement.html#top')
  win.setDestroyOnClose(); 
  win.showCenter();
  win.setConstraint(true, {left:0, right:0, top: 25, bottom:0})
  win.toFront();
}

function tools(tool) {
var win = new Window({id: "tools", className: "spread", title: "Web Development Definitions", width:475, height:450});
win.setURL('../definitions.html#'+tool);
win.setDestroyOnClose(); 
win.setConstraint(true, {left:0, right:0, top: 25, bottom:0})
win.showCenter();
win.toFront();
}

function rss(){
document.getElementById('rss_drop_down').style.display='block';
}

function rssoff(){
document.getElementById('rss_drop_down').style.display='none';
}

////////////////////
// START Live Help Checker
//
function createRequestObject() { 
var ro; 
var browser = navigator.appName; 
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP"); 
}else{
ro = new XMLHttpRequest(); 
} 
return ro;
}
var http = createRequestObject();

function liveHelp(action) {
http.open('GET', '../livehelp/help_online.info?action='+action);
http.onreadystatechange = handleResponse;
http.send(null);
}

function handleResponse() { 
if(http.readyState == 4){ 
var response = http.responseText;

if(response != 0){
//document.getElementById('liveHelpBlock').style.display='block';
}}}

// DONE WITH Live Help Checker
////////////////////


// ]]>