 
function submitForm() {
	var button = document.getElementsByName('btnaddtocart');
	button[0].click();
	//alert( 'hit' );
    //document.MainForm.submit();
}
function runLloydCheck() {
	var add_to_cart = false;
	var urltext;
	urltext =  window.location.href;
	
	if ( urltext.indexOf('ProductDetails.asp') > -1 ) {
	
		var description_code;
		
		var url_parts = urltext.split('?');
		
		if ( url_parts.length > 0 ) {
		
			var get_vars = url_parts[1].split('&');
			
			if ( get_vars.length > 0 ) {
				for (var i = 0;i < get_vars.length;i++) {
					var var_arr = get_vars[i].split('=');
					if ( var_arr.length > 0 ) {
						if ( var_arr[0] == 'lloyd' && var_arr[1] == 'yes' ) {
							add_to_cart = true;
						}
						if ( var_arr[0] == 'ProductCode' ) {
							description_code = var_arr[1];
						}
						if ( var_arr[0] == 'description' ) {
							
							var desc = var_arr[1].replace('.Ix',' , ');
							while (desc.indexOf('.Ix')>-1) {
								desc = desc.replace('.Ix',' , ');
							}
							while (desc.indexOf('_')>-1) {
								desc = desc.replace('_',' ');
							}
							desc = desc.replace('oDASHo',' - ');
							//alert('2');
							//var field = document.getElementsByName('TEXTBOX___4312___' + description_code +    '___107');
							$('#lloyd-option-4312').attr('value',desc);
							
							
						}
						if ( var_arr[0] == 'lc' ) {
							var desc = var_arr[1].replace('.Ix',' , ');
							while (desc.indexOf('.Ix')>-1) {
								desc = desc.replace('.Ix',' , ');
							}
							while (desc.indexOf('_')>-1) {
								desc = desc.replace('_',' ');
							}
							desc = desc.replace('oDASHo',' - ');
							
							//var field = document.getElementsByName('TEXTBOX___4313___' + description_code +    '___107');
							$('#lloyd-option-4313').attr('value',desc);
						}
					}
				}
			}
			
		}
		if (add_to_cart) {
			//setTimeout("submitForm()",1000);
			submitForm();
		}
	}
}
/*
var explode_value;
 
// Where the description is going to be placed
 
var description;
 
// Where the Lloyd code is going to be placed
 
var lloyd_code;
 
var brokenstring = urltext.split('&');
 
//Used to set if this is a Lloyd product.  If yes update fields and submit form.  Otherwise do nothing.
 
var lloyd_product;
 
var acc_product;
 
 
 
//Used to set if this is a B&I Trim product.  If yes update fields and submit form.  Otherwise do nothing.
 
var bit_product;
 
 
 
for(var i = 0;i < brokenstring.length;i++)
 
{
 
    explode_value = brokenstring[i];
 
    if(explode_value.search('ProductCode') >= 0)
 
    {
 
        var description_code_array = brokenstring[i].split('=');
 
        var description_code = description_code_array[1];
 
        description = 'TEXTBOX___4312___' + description_code +    '___107'
 
        lloyd_code =     'TEXTBOX___4313___' + description_code +    '___107'
 
    }
 
    if(explode_value.search('lc=') >= 0)
 
    {
 
        var lc_array = brokenstring[i].split('=');
 
        var lc = lc_array[1];
 
    }
 
    if(explode_value.search('bit_pn=') >= 0)
 
    {
 
        var bit_array = brokenstring[i].split('=');
 
        var bit_part = bit_array[1];
 
    }
 
 
 
    if(explode_value.search('description=') >= 0)
 
    {
 
        var desc_array = brokenstring[i].split('=');
 
        var desc = desc_array[1];
 
    }
 
    if(brokenstring[i] == 'lloyd=yes')
 
    {
 
        lloyd_product = 'yes';
 
    }
 
    if(brokenstring[i] == 'bit=yes')
 
    {
 
        bit_product = 'yes';
 
    }
 
    if(brokenstring[i] == 'acc=yes')
 
    {
 
        acc_product = 'yes';
 
    }
 
 
 
}
 
if(lloyd_product == 'yes' || bit_product == 'yes' || acc_product == 'yes')
 
{
 
    if(bit_product == 'yes')
 
    {
 
        description = description.replace('1136','1205');
 
        lloyd_code = description.replace('1136','1205');
 
        description = description.replace('110','124');
 
        lloyd_code = description.replace('110','124');
 
        lc = bit_product;
 
    }
 
    if(acc_product == 'yes')
    {
        description = description.replace('1136','1352');
        lloyd_code = lloyd_code.replace('1137','1353');
        description = description.replace('110','144');
        lloyd_code = lloyd_code.replace('110','144');
    } 
 
 
    //lc = lc.replace(/.Ix/g,'|');
 
    fields = document.getElementsByName(lloyd_code);
 
    fields[0].value = lc;
 
    //fields[0].disabled = true;
 
    desc = desc.replace(/__/g,' ');
 
    //desc = desc.replace(/.Ix/g,'|');
 
    fields = document.getElementsByName(description);
 
    fields[0].value = desc;
 
    //fields[0].disabled = true;
 
    setTimeout("submitForm()",1000);    
 
}
 */
 
 
