function CheckNullValue () {
		var frm = document.widgetfrm;
		var field1 = frm.TBStyleNo_OS_Category_Master_ID;
		var field2 = frm.TBVendor_IDs;
		var field3 = frm.TBStyleNo_OS_Style_ID;
		var field4 = frm.TBStyleNo_OS_Pattern_ID;
		var field5 = frm.TBStyleNo_OS_Detail_ID;
		var checkidlist1 = frm.checkidlist1;
		var checkidlist2 = frm.checkidlist2;
		var checkidlist3 = frm.checkidlist3;
		var checkidlist4 = frm.checkidlist4;
		var checkidlist5 = frm.checkidlist5;
		var checkidlist6 = frm.checkidlist6;
		var Tcnt = 0;



		var cnt = 0;
		if (field1 != null){
			frm.checkidlist1.value='';
			cnt = 0;

			for (i = 0; i < field1.length; i++){

				if (frm.TBStyleNo_OS_Category_Master_ID[i].checked == true){
					if(cnt > 0){
						checkidlist1.value = checkidlist1.value + ',';
					}
					checkidlist1.value = checkidlist1.value + field1[i].value;
					cnt = cnt + 1;
				}
			}
		}
		var cnt2 = 0;
		if (field2 != null){
			frm.checkidlist2.value='';


			for (i = 0; i < field2.length; i++){

				if (frm.TBVendor_IDs[i].checked == true){
					if(cnt2 > 0){
						checkidlist2.value = checkidlist2.value + ',';
					}
					checkidlist2.value = checkidlist2.value + field2[i].value;
					cnt2 = cnt2 + 1;
				}
			}
		}
		var cnt3 = 0;
		if (field3 != null){
			frm.checkidlist3.value='';
			cnt3 = 0;

			for (i = 0; i < field3.length; i++){

				if (frm.TBStyleNo_OS_Style_ID[i].checked == true){
					if(cnt3 > 0){
						checkidlist3.value = checkidlist3.value + ',';
					}
					checkidlist3.value = checkidlist3.value + field3[i].value;
					cnt3 = cnt3 + 1;
				}
			}
		}
		var cnt4 = 0;
		if (field4 != null){
			frm.checkidlist4.value='';
			cnt4 = 0;

			for (i = 0; i < field4.length; i++){

				if (frm.TBStyleNo_OS_Pattern_ID[i].checked == true){
					if(cnt4 > 0){
						checkidlist4.value = checkidlist4.value + ',';
					}
					checkidlist4.value = checkidlist4.value + field4[i].value;
					cnt4 = cnt4 + 1;
				}
			}
		}
		var cnt5 = 0;
		if (field5 != null){
			frm.checkidlist5.value='';
			cnt5 = 0;

			for (i = 0; i < field5.length; i++){

				if (frm.TBStyleNo_OS_Detail_ID[i].checked == true){
					if(cnt5 > 0){
						checkidlist5.value = checkidlist5.value + ',';
					}
					checkidlist5.value = checkidlist5.value + field5[i].value;
					cnt5 = cnt5 + 1;
				}
			}
		}

		var cnt6 = 0
		//Color value check
		if (frm.checkidlist6.value!="") {
			cnt6 = 1
		}
		Tcnt = cnt+cnt2+cnt3+cnt4+cnt5+cnt6;
		return Tcnt;
	}

	function saveMSS () {
		var frm = document.widgetfrm;
		result = CheckNullValue();

		if ( result > 0) {
			if(frm.MSSKeyValue.value=='' || frm.MSSKeyValue.value=='SAVE YOUR SEARCH STYLE'){
				alert('Please enter your search style.');
				frm.MSSKeyValue.focus();
				return false;
			}
			frm.Action.value="MSS";
			frm.submit();
		}else{
			alert('Please select 1 option at least.');
			return false;
		}
	}
	function widget_search() {
		var frm = document.widgetfrm;
		result = CheckNullValue();

		if ( result > 0) {

			var nSelectlowprice = frm.nPrice1.value;
			var nSelecthighprice = frm.nPrice2.value;


			if ((nSelectlowprice != null) || (nSelecthighprice != null)){
					if (Number(nSelectlowprice) > Number(nSelecthighprice)){

					alert("Please check search Price.");
					return false;
					}

			}

			if ((nSelectlowprice != null) && (nSelecthighprice == null)){

					alert("Please check search Price.");
					return false;

			}

			if ((nSelectlowprice == null) && (nSelecthighprice != null)){

					alert("Please check search Price.");
					return false;

			}

			if ((nSelectlowprice == "") && (nSelecthighprice != "")){

					alert("Please check search Price.");
					return false;

			}

			frm.Action.value="SEARCH";
			frm.submit();

		}else{
			alert('Please select 1 option at least.');
			return false;
		}
	}

	function SameBrandsCheck(str,val) {

		//alert(str+'||'+val);
		var frm = document.widgetfrm;
		var field1 = document.getElementsByName("TBMyFavoriteVendor_ID");
		var field2 = document.getElementsByName("TBVendor_IDs");
		var span_field1 = document.getElementsByName("span_TBMyFavoriteVendor_ID");
		var span_field2 = document.getElementsByName("span_TBVendor_IDs");

		if (str == "TBVendor_IDs"){

			for (i = 0; i < field1.length; i++){

				if (String(field1[i].value) == String(val)){
					document.widgetfrm.TBMyFavoriteVendor_ID[i].checked=true;
				}
			}
		}

		if (str == "TBMyFavoriteVendor_ID"){

			for (j = 0; j < field2.length; j++){

				if (String(val) == String(field2[j].value)){
					//alert(String(field2[j].value)+'||'+"OK"+field2[j].checked);
					if (field2[j].checked==true) {
						field2[j].checked = false;
						addListener(window, 'load', init);
					}else{
						span_field2[j].style.backgroundPosition = "0 -" + 16*3 + "px";
						field2[j].checked = true;
					}

				}
			}
		}
	}

	function overColor (str,val) {

		var field = eval("document.getElementById('"+str+"')");
		if (field.className!="checked") {
			field.className = 'check';
			//value check
		}

	}
	function outColor (str,val) {

		var field = eval("document.getElementById('"+str+"')");

		if (field.className=="check"||field.className=="") {
			field.className = '';
			//value check
		}

	}

	function checkColor (str,val) {
		var frm = document.widgetfrm;
		var len=frm.elements.length;
		var field = eval("document.getElementById('"+str+"')");
		var frmfield = document.widgetfrm.checkidlist6.value;
		var apfrmfield = frmfield.split(",");
		var existing = false;

		if (field.className=="checked") {
			field.className = '';
			//value check
			for (var i=0; i<apfrmfield.length; i++) {
				if(String(val)==String(apfrmfield[i])){
					existing = true;
				}
			}
			if(existing==true){
				var exceptVal = frmfield.split(val);
				if(exceptVal[0]!=","&&exceptVal[1]!=","){
					combineVal = exceptVal[0]+exceptVal[1];
				}

				document.widgetfrm.checkidlist6.value = combineVal;
			}
		}else{
			field.className = 'checked';
			for (var i=0; i<apfrmfield.length; i++) {
				if(String(val)==String(apfrmfield[i])){
					existing = true;
				}
			}
			if(existing==false){
				if (frmfield.length>0) {
					document.widgetfrm.checkidlist6.value = document.widgetfrm.checkidlist6.value + ',' + val;
				}else{
					document.widgetfrm.checkidlist6.value = document.widgetfrm.checkidlist6.value + val;
				}

			}
		}

	}

	//Delete My Search Style Using Iframe
	function delMSS (idx) {
		document.getElementById("MSSFrame").src="/catalog/MSSDel.asp?lang=<%=language%>&<%=SCode%>&MSSSn="+idx;
	}

	function null_chk (frm) {
		if (frm.SearchKeyValue.value.length=0) {
			alert('Please enter search keywords.');
			frm.SearchKeyValue.focus();
			return false;
		}
		return true;
	}
