﻿function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
var http_request = false;
function init()
{
    var URL;
    var index;
    if(!(document.URL.toLowerCase().match("localhost") || document.URL.toLowerCase().match("74.208.184.37")))
    {
        if((document.URL.toLowerCase().match("/member/")) || (document.URL.toLowerCase().match("/shoppingcart/")) || (document.URL.toLowerCase().match("/admin/")))
        {
            if(document.URL.toLowerCase().match("/member/"))
            {
                index = document.URL.toLowerCase().lastIndexOf("/member/");
                URL = document.URL.substr(index, document.URL.length)
                URL = 'https://secure.newyorkdress.com' + URL;
                //alert(URL);
            }
            if(document.URL.toLowerCase().match("/shoppingcart/"))
            {
                index = document.URL.toLowerCase().lastIndexOf("/shoppingcart/");
                URL = document.URL.substr(index, document.URL.length)
                URL = 'https://secure.newyorkdress.com' + URL;
                //alert(URL);
            }
            if(document.URL.toLowerCase().match("/admin/"))
            {
                index = document.URL.toLowerCase().lastIndexOf("/admin/");
                URL = document.URL.substr(index, document.URL.length)
                URL = 'https://secure.newyorkdress.com' + URL;
                //alert(URL);
            }            
            if(document.URL.toLowerCase().match("http://"))
            {
                window.location.href = URL;
                //alert('secure');
            }
        }
        else
        {
            if(document.URL.toLowerCase().match("https://"))
            {
                index = document.URL.toLowerCase().lastIndexOf("newyorkdress.com");
                URL = document.URL.substr(index, document.URL.length)
                URL = 'http://www.' + URL;
                window.location.href = URL;
            }
        }
            
    }
}
function redirect(URL)
{
    location.href = URL;
}
init();
//MM_preloadImages();

function btnSearchClicked()
{
//	var searchValue = document.getElementById('ctl00_tbSearch').value;
//	if ((searchValue.toLowerCase().match("enter item") > 0) || (searchValue = '')) return;
//	try 
//	{
//		var pageTracker = _gat._getTracker("UA-6570195-1");
//		pageTracker._trackPageview("/Search.aspx?Search2=" + searchValue);
//	} 
//	catch(err) {}
}

function GetCountryForMenu()
{   
    var d2 = new Date();  
    var _idn = ''; 
    if (location.href.match('localhost'))
    {
        _idn = d2.getTime(); 
	    GetSearchResultsFromCommon('http://localhost:1565/classiciv/misc/Recieve.aspx', '?func=getcountry&d=' + _idn);
	}
	else
	{
        GetSearchResultsFromCommon('http://www.newyorkdress.com/misc/Recieve.aspx', '?func=getcountry&d=' + _idn);	
	} 
}
function GetSearchResultsFromCommon(url, parameters) 
{
  http_request = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
     http_request = new XMLHttpRequest();
     if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
     }
  } else if (window.ActiveXObject) { // IE
     try {
        http_request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
        try {
           http_request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
     }
  }
  //alert(http_request);
  if (!http_request) {
     alert('Cannot create XMLHTTP instance');
     return false;
  }
  http_request.onreadystatechange = onreturnFromGetSearchResultsFromCommon;
  http_request.open('GET', url + parameters, true);
  http_request.send(null);
}

function onreturnFromGetSearchResultsFromCommon() 
{
	var html = '';
    if (http_request.readyState == 4) 
    {
        if (http_request.status == 200) 
        {
        //if (!((http_request.responseText.toUpperCase() == 'UNITED STATES') || (http_request.responseText.toUpperCase() == 'CANADA') || (http_request.responseText == '')))
        //{
            html += '<div align="right">';
            html += '<table>';
            html += '<tr valign="center"><td width="40%"></td>';
            html += '<td width="40px"><a href="#" ><img src="http://www.newyorkdress.com/Images/Flags/'+http_request.responseText.replace(' ','_').replace(' ','_')+'_small.gif" /></a> </td>';
            html += '<td style="font-size:14px; font-weight:normal" nowrap=nowrap><a href="#" class="graylink" >'+http_request.responseText+'</a></td>';
            html += '</tr>';
            html += '</table>';
            html += '</div>';
            document.getElementById('spnCountryMenu').innerHTML = html;
        //}
        }
    }
}  

function AdvanceSearchPop()
{
    var html = '';
html += '        <table style="background-color:#ffffff; color:#000000; width:660px;" >';
html += '                <tr><td><table>';
html += '                <tr>';
html += '                    <td id="tdpopOccasion" style="width:300px; color:#000000; border-bottom:solid 1px #313131;">';
html += '                        <div><span id="spnTitleOccasion" style="font-weight:bold; font-size:16px">Categories</span>';
html += '                        <span onclick="SelectAll(\'pop\', 11,\'Occasion\')" style="padding:0 20 0 50; color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Select All</span><span onclick="Clear(\'pop\', 11,\'Occasion\')" style="color:FF7F00; cursor:pointer; text-decoration:underline;font-weight:bold">Clear</span></div>';
html += '                       <table id="pop_cblOccasion" border="0">';
html += '                       	<tr>';
html += '                       		<td><input id="pop_cblOccasion_0" type="checkbox" /><label style="color:#000000">Ball Gowns</label></td><td><input id="pop_cblOccasion_6" type="checkbox"  /><label style="color:#000000">Prom Dresses</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblOccasion_1" type="checkbox" /><label style="color:#000000">Cocktail Dresses</label></td><td><input id="pop_cblOccasion_7" type="checkbox"  /><label style="color:#000000">Quinceanera Dresses</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblOccasion_2" type="checkbox" /><label style="color:#000000">Evening Dresses</label></td><td><input id="pop_cblOccasion_8" type="checkbox"  /><label style="color:#000000">Special Occasions</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblOccasion_3" type="checkbox" /><label style="color:#000000">Formal Gowns</label></td><td><input id="pop_cblOccasion_9" type="checkbox"  /><label style="color:#000000">Sweet 16</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblOccasion_4" type="checkbox" /><label style="color:#000000">Homecoming Dresses</label></td><td><input id="pop_cblOccasion_10" type="checkbox"  /><label style="color:#000000">Other Categories</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblOccasion_5" type="checkbox" /><label style="color:#000000">Mother of The Bride</label></td><td></td>';
html += '                       	</tr>';
html += '                       </table>';
html += '                    </td>';
html += '                </tr>';
html += '                <tr>';
html += '                    <td id="tdpopColor" style="width:300px; color:#000000; border-bottom:solid 1px #313131; padding: 10 0 0 0">';
html += '                        <div><span id="spnTitleColor" style="font-weight:bold; font-size:16px">Color</span>';
html += '                        <span onclick="SelectAll(\'pop\', 14,\'Color\')" style="padding:0 20 0 80; color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Select All</span><span onclick="Clear(\'pop\', 14,\'Color\')" style="color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Clear</span></div>';
html += '                       <table id="pop_cblColor" class="cblBlackOnWhite" border="0">';
html += '	                        <tr>';
html += '		                        <td><input id="pop_cblColor_0" type="checkbox" /><label style="color:#000000">White</label></td><td><input id="pop_cblColor_7" type="checkbox" /><label style="color:#000000">Print</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_1" type="checkbox" /><label style="color:#000000" >Black</label></td><td><input id="pop_cblColor_8" type="checkbox" /><label style="color:#000000">Gold</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_2" type="checkbox" /><label style="color:#000000" >Blue</label></td><td><input id="pop_cblColor_9" type="checkbox" /><label style="color:#000000">Silver</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_3" type="checkbox" /><label style="color:#000000" >Red</label></td><td><input id="pop_cblColor_10" type="checkbox" /><label style="color:#000000">Yellow</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_4" type="checkbox" /><label style="color:#000000" >Pink</label></td><td><input id="pop_cblColor_11" type="checkbox" /><label style="color:#000000">Green</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_5" type="checkbox" /><label style="color:#000000" >Purple</label></td><td><input id="pop_cblColor_12" type="checkbox" /><label style="color:#000000">Orange</label></td>';
html += '	                        </tr><tr>';
html += '		                        <td><input id="pop_cblColor_6" type="checkbox" /><label style="color:#000000" >Ivory</label></td><td><input id="pop_cblColor_13" type="checkbox" /><label style="color:#000000">Other Colors</label></td>';
html += '	                        </tr>';
html += '                       </table>';
html += '                    </td>';
html += '                </tr>    ';
html += '                <tr>';
html += '                    <td id="tdpopSize" style="width:300px; color:#000000;border-bottom:solid 1px #313131; padding: 10 0 0 0">';
html += '                        <div><span id="spnTitleSize" style="font-weight:bold; font-size:16px">Size</span>';
html += '                        <span onclick="SelectAll(\'pop\',5,\'Size\')" style="padding:0 20 0 90; color:FF7F00; cursor:pointer; text-decoration:underline;font-weight:bold">Select All</span><span onclick="Clear(\'pop\', 5,\'Size\')" style="color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Clear</span></div>';
html += '                       <table id="pop_cblSize" class="cblBlackOnWhite" border="0">';
html += '                       	<tr>';
html += '                       		<td><input id="pop_cblSize_0" type="checkbox" /><label style="color:#000000">XS (Size 0-2)</label></td><td><input id="pop_cblSize_3" type="checkbox"  /><label style="color:#000000">L (Size 10-12)</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblSize_1" type="checkbox" /><label style="color:#000000">S (Size 4)</label></td><td><input id="pop_cblSize_4" type="checkbox"  /><label style="color:#000000">XL (Size 14+)</label></td>';
html += '                       	</tr><tr>';
html += '                       		<td><input id="pop_cblSize_2" type="checkbox" /><label style="color:#000000">M (Size 6-8)</label></td><td></td>';
html += '                       	</tr>';
html += '                       </table>';
html += '                    </td>';
html += '                </tr>';
html += '                <tr>';
html += '                    <td id="tdpopPrice" style="width:300px; color:#000000;padding: 10 0 0 0">';
html += '                       <div><span id="spnTitlePrice" style="font-weight:bold; font-size:16px">Price Range</span>';
html += '                       <span onclick="SelectAll(\'pop\',3,\'Price\')" style="padding:0 20 0 30; color:FF7F00; text-decoration:underline; cursor:pointer; font-weight:bold">Select All</span><span onclick="Clear(\'pop\',3,\'Price\')" style="color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Clear</span></div>';
html += '                       <table id="pop_cblPrice" class="cblBlackOnWhite" border="0">';
html += '	                        <tr>';
html += '		                        <td><input id="pop_cblPrice_0" type="checkbox" /><label style="color:#000000">Up to $200</label></td><td><input id="pop_cblPrice_1" type="checkbox" /><label style="color:#000000">$200 - $400</label></td><td><input id="pop_cblPrice_2" type="checkbox" /><label style="color:#000000">$400+</label></td>';
html += '	                        </tr>';
html += '                       </table>';
html += '                    </td>';
html += '                </tr>';
html += '                </table></td><td style="padding:0 40 0 0"></td><td><table>';
html += '                <tr>';
html += '                    <td id="tdpopManf" style="width:300px; color:#000000;border-bottom:solid 1px #313131; padding: 7 0 0 0">';
html += '                        <div><span id="spnTitleManf" style="font-weight:bold; font-size:16px">Designer</span>';
html += '                        <span onclick="SelectAll(\'pop\',33,\'Manf\')" style="padding:0 20 0 55; color:FF7F00; text-decoration:underline;cursor:pointer; font-weight:bold;">Select All</span><span onclick="Clear(\'pop\',33,\'Manf\')" style="color:FF7F00; cursor:pointer;text-decoration:underline; font-weight:bold">Clear</span></div>';
html += '                       <table id="pop_cblManf" border="0">';
html += '	                        <tr>';
html += '	                        	<td><input id="pop_cblManf_0" type="checkbox" /><label style="color:#000000" for="pop_cblManf_0">Aidan Mattox</label></td><td><input id="pop_cblManf_17" type="checkbox" /><label style="color:#000000" for="pop_cblManf_17">Joli Prom</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_1" type="checkbox" /><label style="color:#000000" for="pop_cblManf_1">Alexia Admor</label></td><td><input id="pop_cblManf_18" type="checkbox" /><label style="color:#000000" for="pop_cblManf_18">Jovani</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_2" type="checkbox" /><label style="color:#000000" for="pop_cblManf_2">Allure</label></td><td><input id="pop_cblManf_19" type="checkbox" /><label style="color:#000000" for="pop_cblManf_19">La Femme</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_3" type="checkbox" /><label style="color:#000000" for="pop_cblManf_3">Alyce</label></td><td><input id="pop_cblManf_20" type="checkbox" /><label style="color:#000000" for="pop_cblManf_20">Landa</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_4" type="checkbox" /><label style="color:#000000" for="pop_cblManf_4">Badgley Mischka</label></td><td><input id="pop_cblManf_21" type="checkbox" /><label style="color:#000000" for="pop_cblManf_21">Lara</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_5" type="checkbox" /><label style="color:#000000" for="pop_cblManf_5">Basix</label></td><td><input id="pop_cblManf_22" type="checkbox" /><label style="color:#000000" for="pop_cblManf_22">Mac Duggal</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_6" type="checkbox" /><label style="color:#000000" for="pop_cblManf_6">BG Haute</label></td><td><input id="pop_cblManf_23" type="checkbox" /><label style="color:#000000" for="pop_cblManf_23">Mandalay</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_7" type="checkbox" /><label style="color:#000000" for="pop_cblManf_7">Boutique</label></td><td><input id="pop_cblManf_24" type="checkbox" /><label style="color:#000000" for="pop_cblManf_24">Mori Lee</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_8" type="checkbox" /><label style="color:#000000" for="pop_cblManf_8">Cassandra Stone</label></td><td><input id="pop_cblManf_25" type="checkbox" /><label style="color:#000000" for="pop_cblManf_25">Nicole Bakti</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_9" type="checkbox" /><label style="color:#000000" for="pop_cblManf_9">Dave and Johnny</label></td><td><input id="pop_cblManf_26" type="checkbox" /><label style="color:#000000" for="pop_cblManf_26">Nicole Miller</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_10" type="checkbox" /><label style="color:#000000" for="pop_cblManf_10">Ed Hardy</label></td><td><input id="pop_cblManf_27" type="checkbox" /><label style="color:#000000" for="pop_cblManf_27">Scala</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_11" type="checkbox" /><label style="color:#000000" for="pop_cblManf_11">Fabulous</label></td><td><input id="pop_cblManf_28" type="checkbox" /><label style="color:#000000" for="pop_cblManf_28">Sean Collection</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_12" type="checkbox" /><label style="color:#000000" for="pop_cblManf_12">Faviana</label></td><td><input id="pop_cblManf_29" type="checkbox" /><label style="color:#000000" for="pop_cblManf_29">Sherri Hill</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_13" type="checkbox" /><label style="color:#000000" for="pop_cblManf_13">Flip</label></td><td><input id="pop_cblManf_30" type="checkbox" /><label style="color:#000000" for="pop_cblManf_30">Studio 17</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_14" type="checkbox" /><label style="color:#000000" for="pop_cblManf_14">GiGi</label></td><td><input id="pop_cblManf_31" type="checkbox" /><label style="color:#000000" for="pop_cblManf_31">Terani</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_15" type="checkbox" /><label style="color:#000000" for="pop_cblManf_15">Interlude</label></td><td><input id="pop_cblManf_32" type="checkbox" /><label style="color:#000000" for="pop_cblManf_32">Tony Bowls</label></td>';
html += '	                        </tr><tr>';
html += '	                        	<td><input id="pop_cblManf_16" type="checkbox" /><label style="color:#000000" for="pop_cblManf_16">Janique</label></td><td></td>';
html += '	                        </tr>';
html += '                       </table>';
html += '                    </td>';
html += '                </tr>    ';
html += '                <tr><td><span style="color:red" id="spnErrorMessage">&nbsp;<span></td></tr>    ';
html += '                <tr><td align="center" style="padding:15 0 0 0"><img src="/images/buttons/advancedSearch3.jpg" style="cursor:pointer" onclick="AdvancedSearch_click()" /></td></tr>    ';
html += '            </table>';
html += '        </td></tr></table>';
//html += '    </form></body>';
    jQuery.facebox(html);   
    if (readCookie("LastSearch") == null) return;
    cookieValue = readCookie("LastSearch").split('*');
    FillCbl('pop', cookieValue[0], cookieValue[1], cookieValue[2], cookieValue[3], cookieValue[4]);     
    try
    {
        pageTracker._trackEvent("Search", "Advanced Search Pop", location.href);
    }
    catch(err){alert(err);} 
}

function SelectAll(prefix, count, type)
{
    for (var i = 0; i < count; i++)
        document.getElementById(prefix+'_cbl'+type+'_'+i).checked = true;
    if (prefix != 'pop')
        SearchChanged(prefix, count, type);
}
function Clear(prefix, count, type)
{
    for (var i = 0; i < count; i++)
        document.getElementById(prefix+'_cbl'+type+'_' + i).checked = false;
    if (prefix != 'pop')
        SearchChanged(prefix);        
}

function GetOccasion(prefix)
{
 //   var i = 0;
    var strOccasion = '';
    for (var i = 0; i < 11; i++)
        if (document.getElementById(prefix+'_cblOccasion_' + i).checked)
        {
            if(document.all)
                strOccasion += document.getElementById(prefix+'_cblOccasion_' + i).parentNode.innerText + '~';
            else
                strOccasion += document.getElementById(prefix+'_cblOccasion_' + i).parentNode.textContent + '~';
        }
    return strOccasion;
}
function GetColor(prefix)
{
    var strColor = '';
    for (var i = 0; i < 14; i++)
        if (document.getElementById(prefix+'_cblColor_' + i).checked)
            if(document.all)
                strColor += document.getElementById(prefix+'_cblColor_' + i).parentNode.innerText + '~';
            else
                strColor += document.getElementById(prefix+'_cblColor_' + i).parentNode.textContent + '~';
    return strColor
}
function GetManf(prefix)
{
    var strManf = '';
    for (var i = 0; i < 33; i++)
        if (document.getElementById(prefix+'_cblManf_' + i).checked)
            if (document.all)
                strManf += document.getElementById(prefix+'_cblManf_' + i).parentNode.innerText + '~';
            else
                strManf += document.getElementById(prefix+'_cblManf_' + i).parentNode.textContent + '~';
    return strManf;
}
function GetSize(prefix)
{
    var strSize = '';
    for (var i = 0; i < 5; i++)
        if (document.getElementById(prefix+'_cblSize_' + i).checked)
            if (document.all)
                strSize += document.getElementById(prefix+'_cblSize_' + i).parentNode.innerText.substring(0,2) + '~';
            else
                strSize += document.getElementById(prefix+'_cblSize_' + i).parentNode.textContent.substring(0,2) + '~';
    return strSize;
}
function GetPrice(prefix)
{
    var strPrice = '';
    for (i = 0; i < 3; i++)
        if (document.getElementById(prefix+'_cblPrice_' + i).checked)
            if(document.all)
                strPrice += document.getElementById(prefix+'_cblPrice_' + i).parentNode.innerText + '~';                        
            else
                strPrice += document.getElementById(prefix+'_cblPrice_' + i).parentNode.textContent + '~';                        
    return strPrice;
}            
function SearchChanged(prefix)
{
    var isValid = true;
    var strOccasion = GetOccasion(prefix);
    var strColor = GetColor(prefix);
    var strManf = GetManf(prefix);
    var strSize = GetSize(prefix);
    var strPrice = GetPrice(prefix);
    if (prefix == 'pop')
    {
        document.getElementById('spnErrorMessage').innerHTML = '';
        if (strOccasion == '')
        {
            document.getElementById('tdpopOccasion').style.border = 'solid 2px red';
            document.getElementById('spnTitleOccasion').style.color = 'red';
            document.getElementById('spnErrorMessage').innerHTML = document.getElementById('spnErrorMessage').innerHTML + '<b>Categories</b> - Must check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnTitleOccasion').style.color = 'black';
            document.getElementById('tdpopOccasion').style.borderTop = 'solid 1px white';
            document.getElementById('tdpopOccasion').style.borderRight = 'solid 1px white';
            document.getElementById('tdpopOccasion').style.borderLeft = 'solid 1px white';
            document.getElementById('tdpopOccasion').style.borderBottom = 'solid 1px #313131';
        }
    
        if (strColor == '')
        {
            document.getElementById('tdpopColor').style.border = 'solid 2px red';
            document.getElementById('spnTitleColor').style.color = 'red';
            document.getElementById('spnErrorMessage').innerHTML = document.getElementById('spnErrorMessage').innerHTML + '<b>Color</b> - Must check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnTitleColor').style.color = 'black';
            document.getElementById('tdpopColor').style.borderTop = 'solid 1px white';
            document.getElementById('tdpopColor').style.borderRight = 'solid 1px white';
            document.getElementById('tdpopColor').style.borderLeft = 'solid 1px white';
            document.getElementById('tdpopColor').style.borderBottom = 'solid 1px #313131';
        }

        if (strManf == '')
        {
            document.getElementById('tdpopManf').style.border = 'solid 2px red';
            document.getElementById('spnTitleManf').style.color = 'red';
            document.getElementById('spnErrorMessage').innerHTML = document.getElementById('spnErrorMessage').innerHTML + '<b>Designer</b> - Must check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnTitleManf').style.color = 'black';
            document.getElementById('tdpopManf').style.borderTop = 'solid 1px white';
            document.getElementById('tdpopManf').style.borderRight = 'solid 1px white';
            document.getElementById('tdpopManf').style.borderLeft = 'solid 1px white';
            document.getElementById('tdpopManf').style.borderBottom = 'solid 1px #313131';
        }

        if (strSize == '')
        {
            document.getElementById('tdpopSize').style.border = 'solid 2px red';
            document.getElementById('spnTitleSize').style.color = 'red';
            document.getElementById('spnErrorMessage').innerHTML = document.getElementById('spnErrorMessage').innerHTML + '<b>Size</b> - Must check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnTitleSize').style.color = 'black';
            document.getElementById('tdpopSize').style.borderTop = 'solid 1px white';
            document.getElementById('tdpopSize').style.borderRight = 'solid 1px white';
            document.getElementById('tdpopSize').style.borderLeft = 'solid 1px white';
            document.getElementById('tdpopSize').style.borderBottom = 'solid 1px #313131';
        }
    
        if (strPrice == '')
        {
            document.getElementById('tdpopPrice').style.border = 'solid 2px red';
            document.getElementById('spnTitlePrice').style.color = 'red';
            document.getElementById('spnErrorMessage').innerHTML = document.getElementById('spnErrorMessage').innerHTML + '<b>Price Range</b> - Must check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnTitlePrice').style.color = 'black';
            document.getElementById('tdpopPrice').style.borderTop = 'solid 1px white';
            document.getElementById('tdpopPrice').style.borderRight = 'solid 1px white';
            document.getElementById('tdpopPrice').style.borderLeft = 'solid 1px white';
            document.getElementById('tdpopPrice').style.borderBottom = 'solid 1px white';
        }
    }                
    else
    {
        
        if (strOccasion == '')
        {
            document.getElementById('spnTitleOccasion').style.color = 'red';
            document.getElementById('spnErrorOccasion').innerHTML = 'Please check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnErrorOccasion').innerHTML = '&nbsp;';
            document.getElementById('spnTitleOccasion').style.color = 'black';
        }
    
        if (strColor == '')
        {
            document.getElementById('spnTitleColor').style.color = 'red';
            document.getElementById('spnErrorColor').innerHTML = 'Please check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnErrorColor').innerHTML = '&nbsp;';
            document.getElementById('spnTitleColor').style.color = 'black';
        }

        if (strManf == '')
        {
            document.getElementById('spnTitleManf').style.color = 'red';
            document.getElementById('spnErrorManf').innerHTML = 'Please check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnErrorManf').innerHTML = '&nbsp;';
            document.getElementById('spnTitleManf').style.color = 'black';
        }

        if (strSize == '')
        {
            document.getElementById('spnTitleSize').style.color = 'red';
            document.getElementById('spnErrorSize').innerHTML = 'Please check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnErrorSize').innerHTML = '&nbsp;';
            document.getElementById('spnTitleSize').style.color = 'black';
        }
    
        if (strPrice == '')
        {
            document.getElementById('spnTitlePrice').style.color = 'red';
            document.getElementById('spnErrorPrice').innerHTML = 'Please check at least one selection<br />'
            isValid = false;
        }
        else
        {
            document.getElementById('spnErrorPrice').innerHTML = '&nbsp;';
            document.getElementById('spnTitlePrice').style.color = 'black';
        }
    }
        
    if (isValid)
    {
        if (prefix != 'pop')
            AdvancedSearch(strOccasion, strColor, strManf, strSize, strPrice)
        else
        {
            createCookie("LastSearch", strOccasion+'*'+strColor+'*'+strManf+'*'+strSize+'*'+strPrice, 259200);
            window.location.href = "/AdvanceSearch.aspx";
        }
    }
}

function FillCbl(prefix, occasion, color, manf, size, price)
{
    
    for (i = 0; i < 11; i++)
        if(document.all)
        {
            if (occasion.match(document.getElementById(prefix + '_cblOccasion_' + i).parentNode.innerText))
                document.getElementById(prefix + '_cblOccasion_' + i).checked = true;
        }                
        else
        {
            if (occasion.match(document.getElementById(prefix + '_cblOccasion_' + i).parentNode.textContent))
                document.getElementById(prefix + '_cblOccasion_' + i).checked = true;                        
                
        }
            
    for (i = 0; i < 14; i++)
        if (document.all)
        {
            if (color.match(document.getElementById(prefix + '_cblColor_' + i).parentNode.innerText))
                document.getElementById(prefix + '_cblColor_' + i).checked = true;
        }
        else
        {
            if (color.match(document.getElementById(prefix + '_cblColor_' + i).parentNode.textContent))
                document.getElementById(prefix + '_cblColor_' + i).checked = true;
        }       

    for (i = 0; i < 33; i++)
        if (document.all)
        {
            if (manf.match(document.getElementById(prefix + '_cblManf_' + i).parentNode.innerText))
                document.getElementById(prefix + '_cblManf_' + i).checked = true;      
        }
        else
        {
            if (manf.match(document.getElementById(prefix + '_cblManf_' + i).parentNode.textContent))
                document.getElementById(prefix + '_cblManf_' + i).checked = true;  
        }                

    if (size.match('XS'))   document.getElementById(prefix + '_cblSize_' + 0).checked = true;
    if (size.match('S '))    document.getElementById(prefix + '_cblSize_' + 1).checked = true;
    if (size.match('M '))    document.getElementById(prefix + '_cblSize_' + 2).checked = true;
    if (size.match('L '))    document.getElementById(prefix + '_cblSize_' + 3).checked = true;
    if (size.match('XL'))    document.getElementById(prefix + '_cblSize_' + 4).checked = true;
    
    price = price.replace('$','').replace('$','').replace('$','').replace('$','').replace('$','');
    if (price.match('Up to 200'))    document.getElementById(prefix + '_cblPrice_' + 0).checked = true;
    if (price.match('200 - 400'))    document.getElementById(prefix + '_cblPrice_' + 1).checked = true;
    if (price.match('400+'))    document.getElementById(prefix + '_cblPrice_' + 2).checked = true;
}

function AdvancedSearch_click()
{
    SearchChanged('pop');
}
