﻿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 readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ')
            c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0)
            return c.substring(nameEQ.length, c.length);
    }
    return null;
}
function SwapImage(obj) {
    var ext = obj.src.substring(obj.src.lastIndexOf('.'));
    obj.src = obj.src.substring(0, obj.src.length - 4) + '_mo' + ext;
}
function RestoreImage(obj) {
    var ext = obj.src.substring(obj.src.lastIndexOf('.'));
    obj.src = obj.src.substring(0, obj.src.length - 7) + ext;
}

function init()
{
//return;
    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;
            }
        }
    }
    setTimeout("ShowInterContact()", 300);
}
function redirect(URL)
{
    location.href = URL;
}
init();
function ShowInterContact() {
    var country = ((readCookie("CountryName") == null) ? '' : readCookie("CountryName"));
    country = country.replace(/Name=/g, '');
    switch (country.toLowerCase()) {
        case ("france"):
        case ("great britain"):
        case ("australia"):
        case ("ireland"):
        case ("new zealand"):
        case ("south africa"):
            if (document.getElementById('tdSearch') != null)
                document.getElementById('tdSearch').style.backgroundImage = 'url(/images/searchBg/' + country.replace(/ /g, '_') + '.jpg)';
            break;
    }
}


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:860px;" >';
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\',6,\'Size\')" style="padding:0 20 0 90; color:FF7F00; cursor:pointer; text-decoration:underline;font-weight:bold">Select All</span><span onclick="Clear(\'pop\', 6,\'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><input id="pop_cblSize_5" type="checkbox"  /><label style="color:#000000">Plus</label></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:500px; 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\',64,\'Manf\')" style="padding:0 20 0 55; color:FF7F00; text-decoration:underline;cursor:pointer; font-weight:bold;">Select All</span><span onclick="Clear(\'pop\',64,\'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" name="0" /><label style="color:#000000" for="pop_cblManf_0">ABS</label style="color:#000000"></td><td><input id="pop_cblManf_16" type="checkbox" name="16" /><label style="color:#000000" for="pop_cblManf_16">Decode 18</label style="color:#000000"></td><td><input id="pop_cblManf_32" type="checkbox" name="32" /><label style="color:#000000" for="pop_cblManf_32">Lela Rose</label style="color:#000000"></td><td><input id="pop_cblManf_48" type="checkbox" name="48" /><label style="color:#000000" for="pop_cblManf_48">Party Time</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_1" type="checkbox" name="1" /><label style="color:#000000" for="pop_cblManf_1">After Six</label style="color:#000000"></td><td><input id="pop_cblManf_17" type="checkbox" name="17" /><label style="color:#000000" for="pop_cblManf_17">Dessy</label style="color:#000000"></td><td><input id="pop_cblManf_33" type="checkbox" name="33" /><label style="color:#000000" for="pop_cblManf_33">Liat Dahan</label style="color:#000000"></td><td><input id="pop_cblManf_49" type="checkbox" name="49" /><label style="color:#000000" for="pop_cblManf_49">Precious Formals</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_2" type="checkbox" name="2" /><label style="color:#000000" for="pop_cblManf_2">Alexia Admor</label style="color:#000000"></td><td><input id="pop_cblManf_18" type="checkbox" name="18" /><label style="color:#000000" for="pop_cblManf_18">Fabulous</label style="color:#000000"></td><td><input id="pop_cblManf_34" type="checkbox" name="34" /><label style="color:#000000" for="pop_cblManf_34">Liz Fields</label style="color:#000000"></td><td><input id="pop_cblManf_50" type="checkbox" name="50" /><label style="color:#000000" for="pop_cblManf_50">Pretty Maids</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_3" type="checkbox" name="3" /><label style="color:#000000" for="pop_cblManf_3">Alfred Angelo</label style="color:#000000"></td><td><input id="pop_cblManf_19" type="checkbox" name="19" /><label style="color:#000000" for="pop_cblManf_19">Faviana</label style="color:#000000"></td><td><input id="pop_cblManf_35" type="checkbox" name="35" /><label style="color:#000000" for="pop_cblManf_35">LM Collection</label style="color:#000000"></td><td><input id="pop_cblManf_51" type="checkbox" name="51" /><label style="color:#000000" for="pop_cblManf_51">Riva</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_4" type="checkbox" name="4" /><label style="color:#000000" for="pop_cblManf_4">Alfred Sung</label style="color:#000000"></td><td><input id="pop_cblManf_20" type="checkbox" name="20" /><label style="color:#000000" for="pop_cblManf_20">Gigi</label style="color:#000000"></td><td><input id="pop_cblManf_36" type="checkbox" name="36" /><label style="color:#000000" for="pop_cblManf_36">Lotus</label style="color:#000000"></td><td><input id="pop_cblManf_52" type="checkbox" name="52" /><label style="color:#000000" for="pop_cblManf_52">Ruby Gem</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_5" type="checkbox" name="5" /><label style="color:#000000" for="pop_cblManf_5">Allure</label style="color:#000000"></td><td><input id="pop_cblManf_21" type="checkbox" name="21" /><label style="color:#000000" for="pop_cblManf_21">Hannah S</label style="color:#000000"></td><td><input id="pop_cblManf_37" type="checkbox" name="37" /><label style="color:#000000" for="pop_cblManf_37">Mac Duggal</label style="color:#000000"></td><td><input id="pop_cblManf_53" type="checkbox" name="53" /><label style="color:#000000" for="pop_cblManf_53">Scala</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_6" type="checkbox" name="6" /><label style="color:#000000" for="pop_cblManf_6">Alyce</label style="color:#000000"></td><td><input id="pop_cblManf_22" type="checkbox" name="22" /><label style="color:#000000" for="pop_cblManf_22">Interlude</label style="color:#000000"></td><td><input id="pop_cblManf_38" type="checkbox" name="38" /><label style="color:#000000" for="pop_cblManf_38">Mandalay</label style="color:#000000"></td><td><input id="pop_cblManf_54" type="checkbox" name="54" /><label style="color:#000000" for="pop_cblManf_54">Sean Collection</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_7" type="checkbox" name="7" /><label style="color:#000000" for="pop_cblManf_7">Baccio</label style="color:#000000"></td><td><input id="pop_cblManf_23" type="checkbox" name="23" /><label style="color:#000000" for="pop_cblManf_23">Issue NY</label style="color:#000000"></td><td><input id="pop_cblManf_39" type="checkbox" name="39" /><label style="color:#000000" for="pop_cblManf_39">Mignon</label style="color:#000000"></td><td><input id="pop_cblManf_55" type="checkbox" name="55" /><label style="color:#000000" for="pop_cblManf_55">Sentimental</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_8" type="checkbox" name="8" /><label style="color:#000000" for="pop_cblManf_8">Bari Jay</label style="color:#000000"></td><td><input id="pop_cblManf_24" type="checkbox" name="24" /><label style="color:#000000" for="pop_cblManf_24">Janique</label style="color:#000000"></td><td><input id="pop_cblManf_40" type="checkbox" name="40" /><label style="color:#000000" for="pop_cblManf_40">MNM Couture</label style="color:#000000"></td><td><input id="pop_cblManf_56" type="checkbox" name="56" /><label style="color:#000000" for="pop_cblManf_56">Sherri Hill</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_9" type="checkbox" name="9" /><label style="color:#000000" for="pop_cblManf_9">Basix</label style="color:#000000"></td><td><input id="pop_cblManf_25" type="checkbox" name="25" /><label style="color:#000000" for="pop_cblManf_25">Jasz Couture</label style="color:#000000"></td><td><input id="pop_cblManf_41" type="checkbox" name="41" /><label style="color:#000000" for="pop_cblManf_41">Mon Cheri</label style="color:#000000"></td><td><input id="pop_cblManf_57" type="checkbox" name="57" /><label style="color:#000000" for="pop_cblManf_57">Showtime Collection</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_10" type="checkbox" name="10" /><label style="color:#000000" for="pop_cblManf_10">BG Haute</label style="color:#000000"></td><td><input id="pop_cblManf_26" type="checkbox" name="26" /><label style="color:#000000" for="pop_cblManf_26">Joli</label style="color:#000000"></td><td><input id="pop_cblManf_42" type="checkbox" name="42" /><label style="color:#000000" for="pop_cblManf_42">Mori Lee</label style="color:#000000"></td><td><input id="pop_cblManf_58" type="checkbox" name="58" /><label style="color:#000000" for="pop_cblManf_58">Sticks and Stones</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_11" type="checkbox" name="11" /><label style="color:#000000" for="pop_cblManf_11">Blush</label style="color:#000000"></td><td><input id="pop_cblManf_27" type="checkbox" name="27" /><label style="color:#000000" for="pop_cblManf_27">Jovani</label style="color:#000000"></td><td><input id="pop_cblManf_43" type="checkbox" name="43" /><label style="color:#000000" for="pop_cblManf_43">Morrell Maxie</label style="color:#000000"></td><td><input id="pop_cblManf_59" type="checkbox" name="59" /><label style="color:#000000" for="pop_cblManf_59">Studio 17</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_12" type="checkbox" name="12" /><label style="color:#000000" for="pop_cblManf_12">Cameron Blake</label style="color:#000000"></td><td><input id="pop_cblManf_28" type="checkbox" name="28" /><label style="color:#000000" for="pop_cblManf_28">La Belle</label style="color:#000000"></td><td><input id="pop_cblManf_44" type="checkbox" name="44" /><label style="color:#000000" for="pop_cblManf_44">nicole Bakti</label style="color:#000000"></td><td><input id="pop_cblManf_60" type="checkbox" name="60" /><label style="color:#000000" for="pop_cblManf_60">Tadashi</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_13" type="checkbox" name="13" /><label style="color:#000000" for="pop_cblManf_13">Cassandra Stone</label style="color:#000000"></td><td><input id="pop_cblManf_29" type="checkbox" name="29" /><label style="color:#000000" for="pop_cblManf_29">La Femme</label style="color:#000000"></td><td><input id="pop_cblManf_45" type="checkbox" name="45" /><label style="color:#000000" for="pop_cblManf_45">Nicole Miller</label style="color:#000000"></td><td><input id="pop_cblManf_61" type="checkbox" name="61" /><label style="color:#000000" for="pop_cblManf_61">Terani</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_14" type="checkbox" name="14" /><label style="color:#000000" for="pop_cblManf_14">Cynthia Rowley</label style="color:#000000"></td><td><input id="pop_cblManf_30" type="checkbox" name="30" /><label style="color:#000000" for="pop_cblManf_30">Landa</label style="color:#000000"></td><td><input id="pop_cblManf_46" type="checkbox" name="46" /><label style="color:#000000" for="pop_cblManf_46">Niteline</label style="color:#000000"></td><td><input id="pop_cblManf_62" type="checkbox" name="62" /><label style="color:#000000" for="pop_cblManf_62">Tiffany</label style="color:#000000"></td>';
html += '	</tr><tr>';
html += '		<td><input id="pop_cblManf_15" type="checkbox" name="15" /><label style="color:#000000" for="pop_cblManf_15">Dave and Johnny</label style="color:#000000"></td><td><input id="pop_cblManf_31" type="checkbox" name="31" /><label style="color:#000000" for="pop_cblManf_31">Lara</label style="color:#000000"></td><td><input id="pop_cblManf_47" type="checkbox" name="47" /><label style="color:#000000" for="pop_cblManf_47">Panoply</label style="color:#000000"></td><td><input id="pop_cblManf_63" type="checkbox" name="63" /><label style="color:#000000" for="pop_cblManf_63">Tony Bowls</label style="color:#000000"></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 < 64; 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 < 6; 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;
}
var isValid;
var strOccasion;
var strColor;
var strManf;
var strSize;
var strPrice;
var lastSentSearch;
function SearchChanged(prefix)
{
     isValid = true;
     strOccasion = GetOccasion(prefix);
     strColor = GetColor(prefix);
     strManf = GetManf(prefix);
     strSize = GetSize(prefix);
     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') {
            lastSentSearch = strOccasion + '*' + strColor + '*' + strManf + '*' + strSize + '*' + strPrice;
            setTimeout("DoSearch('"+lastSentSearch+"');", 1000);
            //AdvancedSearch(strOccasion, strColor, strManf, strSize, strPrice)
        }
        else {
            createCookie("LastSearch", strOccasion + '*' + strColor + '*' + strManf + '*' + strSize + '*' + strPrice, 2592000);
            window.location.href = "/AdvanceSearch.aspx";
        }
    }
}
function DoSearch(currentSearch) {
    if (currentSearch == strOccasion + '*' + strColor + '*' + strManf + '*' + strSize + '*' + strPrice)
        AdvancedSearch(strOccasion, strColor, strManf, strSize, strPrice);
}
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 < 64; 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;
    if (size.match('Pl')) document.getElementById(prefix + '_cblSize_' + 5).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');
}

function ShowSignUpPop()
{
    var html = "";
    html += '<table style="background-image:url(\'images/emailSignUpBackground.jpg\'); width:284px; height:433px"><tr><td><br /><br />';
    html +='<!-- BEGIN: Constant Contact Bubble Opt-in Email List Form --> <div align="center" style="width:170px; padding:60px 0 0 60px"> ';
    html +='<table width="270" border="0" cellspacing="0" cellpadding="0"> ';
html +='    <tr > ';
html +='        <td width="270" colspan="3" >';
html +='            <div align="center"> ';
html +='                <form name="ccoptin" action="http://visitor.r20.constantcontact.com/d.jsp" target="_blank" method="post" style="margin-bottom:3;"> ';
html +='                    <table><tr> ';
html +='                    <td><font style="font-weight: normal; font-family:Arial; font-size:10px; color:#000000;">Email:</font></td> ';
html +='                    <td><input type="text" name="ea" size="14" value="" style="font-family: Arial; font-size:10px; border:1px solid #999999;"></td> ';
html +='                    <td><input type="submit" name="go" value="Join" class="submit" style="font-family:Arial,Helvetica,sans-serif; font-size:11px;"></td> ';
html +='                    <input type="hidden" name="llr" value="e4wfp5dab"> ';
html +='                    <input type="hidden" name="m" value="1103755402212"> ';
html +='                    <input type="hidden" name="p" value="oi"> ';
html +='                    </tr></table> ';
html +='                </form> ';
html +='            </div></td> ';
html +='    </tr> ';
html +='</table> </div> <!-- END: Constant Contact Bubble Opt-in Email List Form --> <!-- BEGIN: SafeSubscribe --> ';
html +='    <div align="center" style="padding:5px 0 0 10px ;width:270px"> <a href="http://www.constantcontact.com/safesubscribe.jsp" target="_blank"><img src="https://imgssl.constantcontact.com/ui/images1/safe_subscribe_logo.gif" border="0" width="168" height="14" alt=""/></a> ';
html +='    </div> <!-- END: SafeSubscribe -->  ';
    html += '<br /></td></tr></table>';
    jQuery.facebox(html);
}

