 $(document).ready(function(){
	var lFlag = true;
	
	var mainNavOn = {'background-color':'#b0cfe8','cursor':'pointer','color':'#002854'};
	var mainNavOff = {'background-color':'#002854','color':'#ffffff'};
	var subOn = {'display':'block','cursor':'pointer'};
	var subOff = {'display':'none'};
	$('#w_leftColBrowseProduct').click(function(e){
		doLeftColCategoryClick('product');
	});
	$('#w_leftColBrowseLine').click(function(e){
		doLeftColCategoryClick('line');
	});
	$('#w_navBarNewItems,#w_navBarAboutUs,#w_navBarOurDifference,#w_navBarContactUs').hover(
		function(){
			$(this).css(mainNavOn);
		},
		function(){
			$(this).css(mainNavOff);
		}
	);
	$('#w_navBarOurDifference').hover(
		function(){
			$('.w_submenu').css(subOn);
		},
		function(){
			$('.w_submenu').css(subOff);
		}
	);
	
	// horizontal nav clicks....
	$('#w_navBarAboutUs').click(function(e){
		document.location.href = unescape(w_linkObj.aboutUs);
	});
	$('#w_navBarNewItems').click(function(e){
		document.location.href = unescape(w_linkObj.newItems);
	});
	$('#w_navBarOurDifference').click(function(e){
		document.location.href = unescape(w_linkObj.ourDifference);
	});
	$('#w_navBarContactUs').click(function(e){
		document.location.href = unescape(w_linkObj.contactUs);
	});
	// end horizontal nav clicks....
	
	// add class to search input box
	$('#widgetSearch .body .field input').addClass('w_searchInput'); 
	// add default value for search input box
	$('#widgetSearch .body .field input').attr('value','Tip: Enter first 5 characters of sku'); 
	// click the searchbox and delete the default text
	$('#widgetSearch .body .field input').click(function(e){this.value='';});
	// remove text from the search go button
	$('#widgetSearch .body .button a').html('<img src="/images/w_images/buttons/btn_go.gif" border="0">');

	// give input tags of type "image" a unique class name
	$("input[type='image']").addClass('w_formButtonImage');

	// insert extra row in the categoryGrid id'd table
	$('#categoryGrid table tr').after('<tr><td colspan="3" class="w_categoryGridSpacer">&nbsp;</td></tr>');
	
	// insert extra row in the productGrid id'd table
	$('#productGrid table tr').after('<tr><td colspan="3" class="w_categoryGridSpacer">&nbsp;</td></tr>');
	
	// remove <div class="form-label">&nbsp;</div> from the div with css id "extraDetails"
	if ($('#extraDetails')){
		$('.form-label').each(function(i,e){
			var content = $(this).html().replace(/^\s+|\s+$/g,''); // remove all spaces
			if(content == '&nbsp;'){
				$(this).addClass('w_hideElement');
			}
		});
	}
	// ###################################################################################################
	// START ADD ADA IMAGE TO ADA PRODUCT DETAIL PAGE
	if ($('#productDetailWrapper').length != 0){ // if it is a product detail page then....
		var tStr = $('h2:first').html();
		if (tStr.indexOf('ADA') != -1){
			var adaStr = '<div id="ada"><img src="http://www.wabashvalley.com/images/w_images/icon_ada.gif" alt="ADA Accessible" height="49" width="51"></div>'
			$('#addToCartButton').append(adaStr);
		}
	}
	// END ADD ADA IMAGE TO ADA PRODUCT DETAIL PAGE
	// ###################################################################################################
	// START ADJUST QUICKSHIP IMAGES
	if ($('#w_leftColAdaImage').length != 0){ // if the quickship image appears
		setTimeout(doQuickShip,1000);
	}

	function doQuickShip(){
		if ($('#w_materialSelection').length != 0){ // is the material selection select on the page?
	 		$('#w_materialSelection').bind('change',function(e){
				var val = document.productForm.w_materialSelection.options[document.productForm.w_materialSelection.selectedIndex].text;
				var sku = $('#sku').html().replace(/(^\s+|\s+$)/g,'');
				if (val.indexOf('Diamond') != -1 || val.indexOf('Please Select') != -1){
					$('#w_leftColAdaImage').show();	
				} else if (val.indexOf('Rib') != -1){
					if (sku == 'ES420' || sku == 'ES421' || sku == 'CY420' || sku == 'CY421' || sku == 'SP305' || sku == 'LR300' || sku == 'FR400'){
						$('#w_leftColAdaImage').show();	
					}
				} else {
					$('#w_leftColAdaImage').hide();	
				}
			});
 		}	
	}

	// END ADJUST QUICKSHIP IMAGES
	// ###################################################################################################
	// START SETUP TITLES AND BREADCRUMBS ***************************************************************
	// place the page title above the breadcrumbs, and on the relevant pages remove the bcrumb altogether
	var pgs = ['About-Wabash-Valley','Our-Difference','Contact-Us'];
	var pageFoundFlag = false;
	for (i=0;i<pgs.length;i++){
		if (document.location.href.indexOf(pgs[i]) != -1){
			$('#pageContent h2:first').remove();
			pageFoundFlag = true;break;
	}}
	if (!pageFoundFlag){$('#categoryGrid h2:first').before('<h3>' + document.title + '</h3>');}
	if (!pageFoundFlag){$('#productGrid h2:first').before('<h3>' + document.title + '</h3>');}
	if (!pageFoundFlag){$('#productDetail h2:first').before('<h3>' + document.title + '</h3>');}
	// END SETUP TITLES AND BREADCRUMBS *****************************************************************
	// ###################################################################################################
	// START REMOVE TITLES FROM SELECT PAGES ************************************************************
	var titleAr = ['Plastisol Coating','Powder Coating','Healthful Facts'];
	for (ii=0;ii<titleAr.length;ii++){
		if($('#pageContent h2').html() && $('#pageContent h2').html().indexOf(titleAr[ii]) != -1){
			$('#pageContent h2').remove();
			break;
		}
	}
	// END REMOVE TITLES FROM SELECT PAGES **************************************************************
	// ###################################################################################################
	// START MOVE DETAIL PAGE BREADCRUMB TO TOP OF PAGE *************************************************
	/*if ($('#productDetail').length != 0 && ($('#udfs').html() != null)){
		var tempStr = $('#udfs').html();
		var tempAr = tempStr.split('&gt;');
			tempStr = tempAr.join(' > ');
		$('h2').replaceWith('<h2>'+ tempStr +'</h2>');
		$('#udfsLabel').remove();
		$('#udfs').remove();
	}*/
	// END MOVE DETAIL PAGE BREADCRUMMB *****************************************************************
	// ###################################################################################################
	// START FIX DETAIL PAGE DIV ID NAMES ***************************************************************
	if ($('#extraDetails').length != 0){
		$('#extraDetails div').each(function(i,e){
			if ($(this).attr('id').indexOf('personalizationLabel') != -1){
				$(this).attr('id','');
				$(this).addClass('w_personalizationLabel');
			} else if ($(this).attr('id').indexOf('personalization') != -1){
				$(this).attr('id','');
				$(this).addClass('w_personalizationDropDown');
			}
		});
	}
	// END FIX DETAIL PAGE ID NAMES ********************************************************************
	// ###################################################################################################
	// START - PREVENT DROP-DOWN & CHECKBOX PERSONALIZATIONS FROM CHANGING PRODUCT IMAGE
	if ($('#extraDetails').length != 0){
		$('#extraDetails select').each(function(i,e){
			if ($(this).attr('id').indexOf('persInput-') != -1){
				if ($(this).closest('div').prev().html().indexOf('Material') != -1){ // is this a material drop down?
					//$(this).attr('onchange','updateSwatchImage()');
					$(this).attr('id','w_materialSelection');
					$(this).change(function(){
						updateSwatchImage();
						updatePrice();
						drawMainImage('', '', '1', 'drop_down', mList, 'prodAnswerMainImage'); // first arg s the selected value: mListSelectionValue
					});
				}
			}
		});
		if (document.getElementById('w_materialSelection')){
			var mList = document.getElementById('w_materialSelection');
			var mListSelectionValue = mList.options[mList.selectedIndex].value;
			$('#extraDetails select').each(function(i,e){ // target other drop-down lists
				if ($(this).attr('id').indexOf('persInput-') != -1){
					if ($(this).attr('id') != 'w_materialSelection'){
						$(this).change(function(){
							drawMainImage('', '', '1', 'drop_down', mList, 'prodAnswerMainImage');
						});
					}
				}
			});
		}
		$('#extraDetails input').each(function(i,e){ // target checkboxes
			if ($(this).attr('type') == 'checkbox' && $(this).attr('id').indexOf('persInput-') != -1){
				$(this).change(function(event){
					drawMainImage('', '', '1', 'drop_down', mList, 'prodAnswerMainImage');
				});
			}
		});
		/**/
	}
	// END - PREVENT DROP-DOWN & CHECKBOX PERSONALIZATIONS FROM CHANGING PRODUCT IMAGE ******************
	// ##################################################################################################
	// START - FIX CATALOG PAGES THAT DON"T INSERT TD'S WHERE THEY'RE SUPPOSED TO
	if ($('#categoryGrid').length != 0){
		$('#categoryGrid table tbody tr').each(function(i,e){
			if ($(this).children().length == 2){
				$(this).children().each(function(i,e){
					if (i == 1){ // 2nd td, so insert after
						$('<td class="content-odd3">&nbsp;</td>').insertAfter($(this));
					}
				});
			}
		});
	}
	// END - FIX CATALOG PAGES THAT DON"T INSERT TD'S WHERE THEY'RE SUPPOSED TO ************************
	// ###################################################################################################
	// START TOGGLE OPEN THE PROPER HEALTHFUL FACT IF A NAME/VALUE PAIR EXISTS IN THE URL
	if (document.location.href.indexOf('?facts=') != -1){
		var names = new Array('','one','two','three','four','five');
		var ar = document.location.href.split('?facts=');
		if (!isNaN(parseInt(ar[1])) && ar[1].length == 1 && parseInt(ar[1]) < 6 && parseInt(ar[1]) > 0){
			neonixToggle(names[parseInt(ar[1])]+'_TGContent',names[parseInt(ar[1])]+'_TGLink','',false)
		}
	}
	// END TOGGLE OPEN THE PROPER HEALTHFUL FACT IF A NAME/VALUE PAIR EXISTS IN THE URL
	// ###################################################################################################
	// START CHANGE "SKU" TEXT ON PRODUCT DETAIL TO READ "MODEL"
	if ($('#skuLabel')){
		$('#skuLabel').replaceWith('<div id="skuLabel">Model#&nbsp;</div>');	
	}
	// END CHANGE "SKU" TEXT ON PRODUCT DETAIL TO READ "MODEL"
	// ###################################################################################################
	// START REMOVE REDUNDANT "SEARCH" HEADER FROM SEARCH RESULTS PAGE AND MODIFY H3 TAG CONTENTS IN CASE OF LEFT COL NAV'ing
	if ($('#productGrid')){
		if ($('h2').html() == 'Search Results'){
			$('h2').remove();
		}
		var urlStr = document.location.href;
		if ($('h3').html() == 'Search Results' && urlStr.indexOf('topic') != -1){
			var findVal = urlStr.match(/(topic=(\d{1,2})&*)/);
 			//alert(findVal[0] + '\n' + findVal[1] + '\n' + findVal[2]);
			var topics = new Array();
				topics[0] = 'ADA Products';
				topics[1] = 'Ash Urns';
				topics[2] = 'Ash/Trash Urns';
				topics[3] = 'Benches';
				topics[4] = 'Bike Loops';
				topics[5] = 'Clearance Items';
				topics[6] = 'Mounting Plate Covers';
				topics[7] = 'Planters';
				topics[8] = 'Receptacles';
				topics[9] = 'Sandboxes';
				topics[10] = 'Shelters';
				topics[11] = 'Swings';
				topics[12] = 'Tables and Chairs';
				topics[13] = 'Top Lids';
				topics[14] = 'Tree Grates';
			$('h3').replaceWith('<h3>'+topics[findVal[2]]+'</h3>');
			$('.search').remove();
		}
	}
	// END REMOVE REDUNDANT "SEARCH" HEADER FROM SEARCH RESULTS PAGE AND MODIFY H3 TAG CONTENTS IN CASE OF LEFT COL NAV'ing
	// ###################################################################################################
	// START FIX MAIN IMAGE WIDTH - SOME PRODUCTS FOR SOME REASON DON'T DISPLAY THE MAIN IMAGE AT THE PROPER WIDTH IN HTML, SCALING THE IMAGE
	if($('#prodMainImage0')){
		if($('#prodMainImage0 img').attr('width') != '436'){
			$('#prodMainImage0 img').attr('width','436');
		}
		//if($('#prodMainImage0 img').attr('height') != '250'){
		//	$('#prodMainImage0 img').attr('height','250');
		//}
	}
	// END FIX MAIN IMAGE WIDTH - SOME PRODUCTS FOR SOME REASON DON'T DISPLAY THE MAIN IMAGE AT THE PROPER WIDTH IN HTML, SCALING THE IMAGE
	// ###################################################################################################
	// START HIDE THE MOUNTING TYPE - ITS STILL IN THE PRODUCT"S PERSONALIZATIONS FOR ORDERING PERPOSES (THEYARE SET AS DEFAULT)
	if ($('.w_personalizationLabel')){
		$('.w_personalizationLabel').each(function(i,e){
			if ($(this).html().indexOf('Mounting Type') != -1){
				$(this).parent().attr('style','display:none');
			}
		});
	}
	// END HIDE THE MOUNTING TYPE - ITS STILL IN THE PRODUCT"S PERSONALIZATIONS FOR ORDERING PERPOSES (THEYARE SET AS DEFAULT)
	// ###################################################################################################
	// START FIX #productPhotos DIV IN-LINE STYLE BY REMOVING IT
	if ($('#productPhotos').length != 0){
		if($('#productPhotos').attr('style').indexOf('height: 280px') != -1){
			$('#productPhotos').removeAttr('style');
		}
	}
	// END FIX #productPhotos DIV IN-LINE STYLE BY REMOVING IT
	// ###################################################################################################
	// START REMOVE STATUS COLUMN FROM ACCOUNT PAGE
	if ($('#clientAccount #orderList').length != 0){ // we are on the user's account page
		$('#clientAccount #orderList table tr td').each(function(i,e){
			var val = i / 4;
			var str = val.toString();
			if (str.indexOf('.75') != -1){
				$(this).html('&nbsp;'); // overwrite the last TD in each row
			}
		});
		$('#clientAccount #orderList table tr th').each(function(i,e){
			var val = i / 4;
			var str = val.toString();
			if (str.indexOf('.75') != -1){
				$(this).html('&nbsp;'); // overwrite the last TH in each row
			}
		});

	}
	// END REMOVE STATUS COLUMN FROM ACCOUNT PAGE
	// ###################################################################################################
	// START ADD TEXT TO SEARCH PAGE IN EVENT NO MATCHED ITEMS ARE FOUND
	if ($('#productGrid #pageNote').length != 0){
		if ($('#pageNote').html().indexOf('No items matched your search terms') != -1){
			var extraCopy = '<div style="margin-left:25px;margin-top:25px;">';
				extraCopy += '<p>If you are searching by Product Sku number then try entering only the first 5 characters of the sku. ';
				extraCopy += 'For example, if you are searching for <b>CL306D</b> try <b>CL306</b> instead - '
				extraCopy += 'without the trailing letter.</p>'
				extraCopy += '</div>';
			$('#pageNote').after(extraCopy);	
		}
	}
	// START ADD TEXT TO SEARCH PAGE IN EVENT NO MATCHED ITEMS ARE FOUND
	// ###################################################################################################
	// START HILITE OR OTHERWISE IDENTIFY CURRENT PAGE WITHIN PAGINATION LINKS- not used, am using css instead
	/*if ($('#pagination')){
		var docUrl = document.location.href;
		var docVars = docUrl.split('?');
		var docPairs = docVars[1].split('&');
		var pagePair = 0; // the pageNumber name/value pair
		var pageNum = 0; // the value of pageNumber
		for (i=0;i<docPairs.length;i++){
			if (docPairs[i].indexOf('pageNumber') != -1){
				pagePair = i;
				break;
			}
		}
		pageNum = docPairs[pagePair].split('='); // this is the page number
		// now locate the pagination div and the current page anchor
		$('.pagination a').each(function(i,e){
			if ($(this).html().indexOf(pageNum[1].toString()) != -1){
				alert('inside');
				$(this).html = '<b><font size="5">&nbsp;&nbsp;'+pageNum[1]+'&nbsp;&nbsp;</font></b>';	
			}
		});
		
	}*/
	// ###################################################################################################
	// THE FOLLOWING IS USED SO WE CAN HIDE ALL OF THE STUFF WE NEED TO HIDE UNTIL WE GET SHIPPING WORKING
	if ($('#checkoutComplete').length != 0){
		// remove print receipt
		if ($('.container .hdr-title').html().indexOf('Print Receipt') != -1){
			$('.container .hdr-title a').remove();
		}
		// change page title
		if ($('.container h2').html() == 'Order Complete'){
			$('.container h2').html('Quote Request Complete');
		}
		// change the order # text
		if ($('.container .hdr-title').html().indexOf('Order #') != -1){
			var xStr = $('.container .hdr-title').html();
			var strEnd = xStr.split('Order #');
			var newStr = 'Quote Request #' + strEnd[1];
			$('.container .hdr-title').html(newStr);
		}
			
		// change the first paragraph
		$('#pageNote').html('Thank you, your request for quote is now complete. An email receipt has been sent to the email address you provided.');
	}
	// Hide shipping-related stuff on the cart page....
	if ($('#cartInfo').length != 0){
		if ($('#pageNote').length != 0){
			$('#pageNote').remove();
		}
		$('#cartAmounts div').each(function(i,e){
			if ($(this).html().indexOf('Shipping') != -1){
				$(this).remove();
			}
			if ($(this).html().indexOf('New Total') != -1){
				$(this).remove();
			}
		});
	}
	
	// allproducts are elgibible for free shipping... so remove the text that appears on all product pages
	if ($('#freeShipping').length != 0){
		$('#freeShipping').remove();
	}
	// if we are on the checkout page
	if ($('#checkoutOnePage').length != 0){
		// REMOVE the shipping method - we will insert a hidden input to specify free shipping
		 if($('#shipMethod').length != 0){
			 $('#shipMethod').remove();
		 }
		
		// add free shipping to the order
		$('#checkoutOnePage form').append('<input type="hidden" name="shippingOption" value="FREE">');
	
		// hide the payment info stuff on the checkout screen, and insert default payment info data so that the cart will work
		if ($('#paymentInfo').length != 0){
			var formEl = document.address;
			formEl.type.selectedIndex = 1;
			formEl.number.value = '4571599300457522';
			formEl.holdersName.value = 'Ignore the CC Number as this is a QUOTE';
			formEl.expirationDate.value = '05/15';
			//formEl.CVV2.value = '123';
			
			// start hide rows - hide everything BUT the coupon field
			$('#paymentInfo table tr').each(function(i,e){
				if ($(this).html().indexOf('Card') != -1 || $(this).html().indexOf('CVV2') != -1){
					$(this).css('display','none');
				}
			});
			// add the "click to apply" text after the coupon field
			$('#paymentInfo input').each(function(i,e){
				if ($(this).attr('name').indexOf('couponCode') != -1){
					$(this).after(' <a href="javascript:;" class="list">Click here to apply coupon</a>');
				}
			});
		}
		
		// hide the sales tax
		$('#totalsInfo tr').each(function(i,e){
			if($(this).html().indexOf('tax') != -1){
	 			$(this).css('display','none');
			}
		});

		// hide the "update totals" button
		if ($('.totalBtns').length != 0){
			$('.totalBtns input').each(function(i,e){
				if (i == 0){
					$(this).css('display','none');
				}
			});
		}
		
		// hide the shipping total div
		if ($('#shipping_total_div').length != 0){
			//$('#shipping_total_div').parent().parent().remove();
			$('#shipping_total_div').parent().parent().css('display','none');
		}
	}
	
	// this is for the client account page
	if ($('#clientAccount').length != -1){
		$('#clientAccount #orderList').remove();
	}
	// END THE FOLLOWING IS USED SO WE CAN HIDE ALL OF THE STUFF WE NEED TO HIDE UNTIL WE GET SHIPPING WORKING
	// ###################################################################################################
/*	// PLACE THE SHIPPING INFORMATION TEXT AREA ON THE PAGE

// THIS IS PRE-EMPTED BY THE UPDATED CODE ABOVE!!!!! search for the comment: start hide rows

	if ($('#checkoutOnePage').length != 0){
		// remove shipping notes field:
		$('#paymentInfo textarea').each(function(i,e){
			if ($(this).attr('name') == 'shipInstructions'){
				$(this).remove();	
			}
		});
		// insert shipping notes field
		var shipCode = '<h2>Notes:</h2><table cellpadding="0" cellspacing="0" border="0">'
			shipCode += '<tr><td class="form-label">Shipping<br>Instructions:&nbsp;</td>';
			shipCode += '<td><textarea name="shipInstructions" cols="35" rows="4"></textarea>';
			shipCode += '</td></tr></table>';
			shipCode += '<h2>Total</h2>';
		$('#paymentInfo').after(shipCode);
	}
	// END PLACE THE SHIPPING INFORMATION TEXT AREA ON THE PAGE
	// ###################################################################################################
*/	
	
	function delay(){
		$('#w_leftColBrowseProductLinks').slideToggle('fast');
		$('#w_leftColBrowseLineLinks').slideToggle('fast');
	}

	function doLeftColCategoryClick(arg){
		if (arg == 'line'){
			$('#w_leftColBrowseProduct a').toggleClass('w_leftColBrowseProductHover',lFlag);
			$('#w_leftColBrowseLine a').toggleClass('w_leftColBrowseLineHover',!lFlag);
			setTimeout(delay,20);
			lFlag = !lFlag;
			setCookie('wabashnav','1','1'); // 1 = browse by line
		} else if (arg == 'product'){
			$('#w_leftColBrowseProduct a').toggleClass('w_leftColBrowseProductHover',lFlag);
			$('#w_leftColBrowseLine a').toggleClass('w_leftColBrowseLineHover',!lFlag);
			setTimeout(delay,20);
			lFlag = !lFlag;
			setCookie('wabashnav','2','1'); // 2 = browse by product
		}
	}

	function setCookie(name,value,days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		document.cookie = name + '=' + value + '; expires=' + date.toGMTString() + '; path=/';
	}
	
	function getCookie(name){
		var cString = document.cookie.split(';');
		var cIndex, cNameAr;
		for (i=0;i<cString.length;i++){
			if (cString[i].indexOf(name) != -1){
				cIndex = i;
				break;
			}
		}
		if (cIndex){
			cNameAr = cString[i].split('=');
			return cNameAr[1];
		}
	}
	
	function checkCookie(cn){
		var cv = getCookie(cn);
		//alert(cv);
		if (cv){
			if (cv == '1'){ // line
				//doLeftColCategoryClick('line');
				$('#w_leftColBrowseProductLinks').hide();
				$('#w_leftColBrowseLineLinks').show();
			} else if (cv == '2'){ // product
				//doLeftColCategoryClick('product');
				$('#w_leftColBrowseProductLinks').show();
				$('#w_leftColBrowseLineLinks').hide();
			}
		}
	}
	
	// check if the user previously chose the "line" menu over the "product" menu
	checkCookie('wabashnav');
	
 	if ($('#extraDetails').length != 0){
		updateSwatchImage();
	}

	
});
 
 
function neonixToggle(itemID,linkID,anchorID,tSwitch){// Neonix Toggle Ver 3.0.1 - www.neonix.net
    if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){
        var itemEL = document.getElementById(itemID);
        var linkEL = document.getElementById(linkID);
        itemEL.className = itemEL.className == 'TG_visible' ? 'TG_hidden' : 'TG_visible';
    }
    if (anchorID.length != 0){;
        document.location.href = '#' + anchorID;
    }
}
if (document.getElementById && navigator.userAgent.indexOf('Opera') == -1){
	document.writeln('<style type="text/css">');
	document.writeln('.TG_visible {display: normal;}');
	document.writeln('.TG_hidden {display: none;}');
	document.writeln('</style>');
}


function updateSwatchImage(){
	if (document.getElementById("w_materialSelection")){
		var input = document.getElementById("w_materialSelection");
		var str = input.options[input.selectedIndex].text.toLowerCase();
		var divAr = new Array('diamond','perforated','rib','rod','welded','slat','square','solid','traditional','mission','universal','santa','weave');
	
		for (i=0;i<divAr.length;i++){
			var tempEl = document.getElementById(divAr[i]);
			tempEl.className = 'w_swatchHide';
		}
		
		for (i=0;i<divAr.length;i++){
			if (str.indexOf(divAr[i]) != -1){
				var tempEl = document.getElementById(divAr[i]);
				tempEl.className = 'w_swatchShow';
				break;
			}
		}
	}
}

