﻿// JScript File

var lhLCTypeSelectionLast = '';
var lhLCTypeColorLast = '';
var lhLCTypeStringsLast = '';




function lcCTChangePriceFrom(fx_ref) {

    lcCTChangePriceFixUp()

    var varvalue = document.getElementById('lhFldPriceFrom').value

    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCPriceFrom=' + varvalue, '', 'cnxajaxrec','cnxajaxrec', 1)

    lcCTRefreshProducts(fx_ref)

}


function lcCTChangePriceTo(fx_ref) {

    lcCTChangePriceFixDown()
    
    var varvalue = document.getElementById('lhFldPriceTo').value

    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCPriceTo=' + varvalue, '', 'cnxajaxrec','cnxajaxrec', 1)
    lcCTRefreshProducts(fx_ref)

}


function lcCTChangePriceFixUp() {

    if ( document.getElementById('lhFldPriceFrom').selectedIndex > document.getElementById('lhFldPriceTo').selectedIndex ) {
    
        document.getElementById('lhFldPriceTo').selectedIndex = document.getElementById('lhFldPriceFrom').selectedIndex
    
    }

}



function lcCTChangePriceFixDown() {

    if ( document.getElementById('lhFldPriceFrom').selectedIndex > document.getElementById('lhFldPriceTo').selectedIndex ) {
    
        document.getElementById('lhFldPriceFrom').selectedIndex = document.getElementById('lhFldPriceTo').selectedIndex
    
    }

}



function lhCTChangeTab(fx_newtab, fx_ref) {

    changeClass('lhLCTypeTab_All', '');
    changeClass('lhLCTypeTab_Pedal', '');
    changeClass('lhLCTypeTab_Lever', '');    
    
    
    changeClass('lhLCTypeTab_' + fx_newtab, 'up');
    
    document.getElementById('lhLCTypeTab_' + fx_newtab).blur();

    document.getElementById('lhLCTypesBox').innerHTML = document.getElementById('lhLCOptionsDataBox_' + fx_newtab).innerHTML;
    
    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCTypeTabUp=' + fx_newtab, '', 'cnxajaxrec','cnxajaxrec', 1)

    lcCTRefreshProducts(fx_ref)
}


function lhCTChangeSelection(fx_newselection, fx_ref) {

    if (lhLCTypeSelectionLast != '') {
    
        changeClass('lhLCOptionsDataBoxItemLink_' + lhLCTypeSelectionLast, '');
    
    }
    
    
    changeClass('lhLCOptionsDataBoxItemLink_' + fx_newselection, 'up');
    
    lhLCTypeSelectionLast = fx_newselection;
    
    document.getElementById('lhLCOptionsDataBoxItemLink_' + fx_newselection).blur();
    
    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCTypeSelection=' + fx_newselection, '', 'cnxajaxrec','cnxajaxrec', 1)
    
    lcCTRefreshProducts(fx_ref)

}


function lhCTLoadFirst() {

    document.getElementById('lhLCOptionBox_Color').innerHTML = document.getElementById('lhLCOptionsDataBox_Color').innerHTML;
    document.getElementById('lhLCOptionBox_Strings').innerHTML = document.getElementById('lhLCOptionsDataBox_Strings').innerHTML;

}


function lhCTChangeColor(fx_newitem, fx_ref) {


    if (lhLCTypeColorLast != '') {
    
        changeClass('lhLCOptionsDataBoxItemLink_' + lhLCTypeColorLast, '');
    
    }
    
    
    changeClass('lhLCOptionsDataBoxItemLink_' + fx_newitem, 'up');
    
    
    lhLCTypeColorLast = fx_newitem;
    
    document.getElementById('lhLCOptionsDataBoxItemLink_' + fx_newitem).blur();
            
    
    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCTypeColor=' + fx_newitem, '', 'cnxajaxrec','cnxajaxrec', 1)
    
    lcCTRefreshProducts(fx_ref)

}





function lhCTChangeStrings(fx_newitem, fx_ref) {

    if (lhLCTypeStringsLast != '') {
    
        changeClass('lhLCOptionsDataBoxItemLink_' + lhLCTypeStringsLast, '');
    
    }
    
    
    changeClass('lhLCOptionsDataBoxItemLink_' + fx_newitem, 'up');
    
    lhLCTypeStringsLast = fx_newitem;
    
    document.getElementById('lhLCOptionsDataBoxItemLink_' + fx_newitem).blur();
    
    
    ajaxgetdata('/site/content/controls/ajax_actions.cnx?lhLCTypeStrings=' + fx_newitem, '', 'cnxajaxrec','cnxajaxrec', 1)
    
    lcCTRefreshProducts(fx_ref)

}



function lcCTRefreshProducts(fx_ref) {

    //var varlocation = 'testing';
    
    var varlocation = window.location.pathname;
     

    if (fx_ref==1) {
        
        var varlocindex = varlocation.indexOf('.com/products.htm')

        if ( varlocation != '/products.htm' ) {
            window.location = 'http://www.lyonhealycpo.com/products.htm';
        } else {
        
            ajaxgetdata('/site/web/productlist/get.cnx?show=all', '', 'lhproductlistcont','lhproductlistcont', 1)                    
        
        }
               

    }
}

function tsPop(fx_app, fx_form, fx_title) {    
    var var_postdata = '';
    tb_show(fx_title,'#TB_inline?height=455&width=610&inlineId=tbapploading');
    if (fx_form!='') {
        if (document.getElementById(fx_form)!=null) {
            var_postdata = formData2QueryString(document.getElementById(fx_form));
        }            
    }
	if (Left(fx_app,1)=='/')
	{
		ajaxgetdata(fx_app, var_postdata, 'TB_ajaxContent','TB_ajaxWindowTitle', 1);
	} else {
	    ajaxgetdata(fx_app, var_postdata, 'TB_ajaxContent','TB_ajaxWindowTitle', 1);
	}

}

function playFlashVideo() {

		var flashvars = {
		};
		var params = {
		  menu: 'false'
		};
		var attributes = {
		  id: 'homeFlashCont',
		  name: 'homeFlashCont'
		};

		swfobject2.embedSWF('/graphics/fw/video2.swf', 'videoFlashCont', '600', '445', '9.0.0','expressInstall.swf', flashvars, params, attributes);

}
