function HLtext(inLine,subline)
{
document.getElementById('txtGiftMessage' + inLine + '[' + subline + ']').select();
}

function init() {
    // TODO:START remove this when you create navigation controls
    if ($('csiHeader')) {
        clientSideInclude('csiHeader', 'includes/header.asp');
    }
    if ($('csiFooter')) {
        clientSideInclude('csiFooter', 'includes/footer.html');
    }
    if ($('csiSpreadTheWord')) {
        clientSideInclude('csiSpreadTheWord', 'includes/spreadtheword.asp');
    }
    if ($('csiMostNeededGifts')) {
        clientSideInclude('csiMostNeededGifts', 'includes/mostneeded.asp');
    }
    if ($('csiPopularGifts')) {
        clientSideInclude('csiPopularGifts', 'includes/populargifts.asp');
    }
    //TODO: END


	  // form field default text/blanking handling
    $$('.formTextFieldDefaultText').each(function(field) {

        var defaultValue = field.value;
        field.addEvent('focus', function() { blankField(this, defaultValue); });
        field.addEvent('blur', function() { checkBlankedField(this, defaultValue) });
    });

    // images that are rollovers can use the "rollover" calss an automatically get the "_over" image
    $$('.rollover').each(function(img) {
        var src = img.getProperty('src');
        var extension = src.substring(src.lastIndexOf('.'), src.length)
        img.addEvent('mouseenter', function() {
            img.setProperty('src', src.replace(extension, '_over' + extension));
        });
        img.addEvent('mouseleave', function() {
            img.setProperty('src', src);
        });
    });



    // Uncomment this to test the "added to cart" message
    //showBasketMessage();

} // End function init

function initnohead() {
    // TODO:START remove this when you create navigation controls
    if ($('csiFooter')) {
        clientSideInclude('csiFooter', 'includes/footer.html');
    }
   // if ($('csiSpreadTheWord')) {
   //     clientSideInclude('csiSpreadTheWord', 'includes/spreadtheword.asp');
   // }
   // if ($('csiMostNeededGifts')) {
   //     clientSideInclude('csiMostNeededGifts', 'includes/mostneeded.asp');
   // }
    //if ($('csiPopularGifts')) {
    //    clientSideInclude('csiPopularGifts', 'includes/populargifts.asp');
    //}
    //TODO: END


	

  // form field default text/blanking handling
  //  $$('.formTextFieldDefaultText').each(function(field) {

//      var defaultValue = field.value;
//      field.addEvent('focus', function() { blankField(this, defaultValue); });
//    	field.addEvent('blur', function() { checkBlankedField(this, defaultValue) });
//    });
  //      

    // images that are rollovers can use the "rollover" calss an automatically get the "_over" image
    $$('.rollover').each(function(img) {
        var src = img.getProperty('src');
        var extension = src.substring(src.lastIndexOf('.'), src.length)
        img.addEvent('mouseenter', function() {
            img.setProperty('src', src.replace(extension, '_over' + extension));
        });
        img.addEvent('mouseleave', function() {
            img.setProperty('src', src);
        });
    });


    // Uncomment this to test the "added to cart" message
    //showBasketMessage();

} // End function init

function showProduct(id) {
    //TB_show("", "product.asp?TB_iframe=true&height=615&width=810",false);
    TB_show("", "product.asp?basesku=" + id + "&TB_iframe=true&height=582&width=810",false);
}

// form fields
function blankField(field, defaultValue) {
    if (field.value == defaultValue) {
        field.value = '';
        $(field).setProperty('class','formTextField');
    }
}
function checkBlankedField(field, defaultValue) {
    if (field.value.length == 0) {
        field.value = defaultValue;
        $(field).setProperty('class', 'formTextFieldDefaultText');
    }
}
function blankSearchField(field, defaultValue) {
    if (field.value == defaultValue) {
        field.value = '';
        $(field).setProperty('class', 'formTextBoxSearch');
    }
}
function checkBlankedSearchField(field, defaultValue) {
    if (field.value.length == 0) {
        field.value = defaultValue;
        $(field).setProperty('class', 'formTextBoxSearchDefaultText');
    }
}

// spread the word sections
// this is only intended to be included on one page ata time 
// it will not suport two forms of this type on the same page
function spreadTheWordPart1() {
    $('spreadWordPart1').setStyle('display', 'block');
    $('spreadWordPart2').setStyle('display', 'none');
    $('spreadWordPart3').setStyle('display', 'none');
}
function spreadTheWordPart2() {
    $('spreadWordPart1').setStyle('display', 'none');
    $('spreadWordPart2').setStyle('display', 'block');
    $('spreadWordPart3').setStyle('display', 'none');
}
function spreadTheWordPart3() {
    $('spreadWordPart1').setStyle('display', 'none');
    $('spreadWordPart2').setStyle('display', 'none');
    $('spreadWordPart3').setStyle('display', 'block');
}


// Show and autohide the "added to cart" message
function showBasketMessage() {
    var elem = $('addedToCartMessage')
    elem.setStyle('opacity', '0');
    elem.setStyle('display', 'block');
    elem.fade('in');
    setTimeout("hideBasketMessage()", 4000);
}
function hideBasketMessage() {
    $('addedToCartMessage').fade('out');
}



// **************************************************************************//
// **************************************************************************//
// **************************************************************************//
/* TODO: These variables and methods are used specifically for these templates
Acquity should remove this code and use their own navigational controls */
// *************************************************************************//
function clientSideInclude(id, url) {
    var req = false;
    // For Safari, Firefox, and other non-MS browsers
    if (window.XMLHttpRequest) {
        try {
            req = new XMLHttpRequest();
        } catch (e) {
            req = false;
        }
    } else if (window.ActiveXObject) {
        // For Internet Explorer on Windows
        try {
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                req = false;
            }
        }
    }
    var element = document.getElementById(id);
    if (!element) {
        alert("Bad id " + id +
		"passed to clientSideInclude." +
		"You need a div or span element " +
		"with this id in your page.");
        return;
    }
    if (req) {
        // Synchronous request, wait till we have it all
        req.open('GET', url, false);
        req.send(null);
        element.innerHTML = req.responseText;
    } else {
        element.innerHTML =
		"Sorry, your browser does not support " +
		"XMLHTTPRequest objects. This page requires " +
		"Internet Explorer 5 or better for Windows, " +
		"or Firefox for any system, or Safari. Other " +
		"compatible browsers may also exist.";
    }

} // End function clientSideInclude

// Function to get query string value
// strName is the the name of the field
// of the field=value query string pair
function getQueryVariable(strName) {

    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] == strName) {
            
            return pair[1];

        } // End if statement

    } // End for loop

} // End function getQueryVariable