
function fit_window() 
{
	self.name = "Parent_Window"; 
	var new_window = "left=" + (screen.width-840)/2 + ",top=" + (screen.height-470)/2 + ",scrollbars,resizable,width=840,height=470";
	OpenWindow = window.open("/fit_guide/fit_guide.asp", "remote", new_window);
	OpenWindow.moveTo((screen.width-840)/2,(screen.height-470)/2);
}

function register_new_account(){
	var cust_email = document.getElementById("customer_email_sign_up").value;		
	document.email_signup_header.action = "AddEmailAddress?newemail=" + cust_email;
	return true;
}
									
function refreshOption()
{
  //document.frmShop.shopBy.BOOKLET=document.location.href="exclusive_brands";
    obj = document.frmShop.shopBy;
    str_style = obj.options[obj.selectedIndex].value;
    //alert(str_style);
    strurl = str_style
   	if (str_style != ""){
   	location.href=strurl;
	}
}
function fastfind_onclick(){
	//if (document.getElementById("booklet_number").value=="item #")
	//var fastfind_url = "petite_product_page?item=&pagesize=3&fastfind=1";
	//else
	var fastfind_url = "search_results?keyword=" + document.getElementById("booklet_number").value;
	//var fastfind_url = "lane_bryant_product_page?item=" + document.getElementById("Textbox1").value + "&pagesize=3&fastfind=1";
	location.href = fastfind_url;
}
function fastfind_onclick2(){
	//if (document.getElementById("booklet_number").value=="item #")
	//var fastfind_url = "petite_product_page?item=&pagesize=3&fastfind=1";
	//else
	var fastfind_url = "search_results?keyword=" + document.getElementById("booklet_number2").value;
	//var fastfind_url = "lane_bryant_product_page?item=" + document.getElementById("Textbox1").value + "&pagesize=3&fastfind=1";
	location.href = fastfind_url;
}
//***hide the product thumbnails dropdown****
function drpweb_priceShow()
{
  var web_price = document.getElementById('CGROUP.SHOPPRICE');
  if ( web_price != null)
  {
   document.getElementById('CGROUP.SHOPPRICE').style.visibility='visible';
  }
}
function drpweb_sizeShow()
{
  var web_size = document.getElementById('CGROUP.SHOPSIZE');
  if ( web_size != null)
  {
   document.getElementById('CGROUP.SHOPSIZE').style.visibility='visible';
  }
}
function drpweb_iPpageShow()
{
  var web_ipp = document.getElementById('itemsPpage');
  if ( web_ipp != null)
  {
   document.getElementById('itemsPpage').style.visibility='visible';
  }
}
function drpweb_priceHide()
{
 var web_price = document.getElementById('CGROUP.SHOPPRICE');
 if ( web_price != null)
  {
    document.getElementById('CGROUP.SHOPPRICE').style.visibility='hidden';
    //alert ("drpweb_priceHide");
  }
}
function drpweb_sizeHide()
{
 var dont_hide = document.getElementById('donthide');
 if (dont_hide==null){
 var web_size = document.getElementById('CGROUP.SHOPSIZE');
 if ( web_size != null)
  {
    document.getElementById('CGROUP.SHOPSIZE').style.visibility='hidden';
    //alert ("drpweb_sizeHide");
  } }
}
function drpweb_iPpageHide()
{
 var web_ipp = document.getElementById('itemsPpage');
 if ( web_ipp != null)
  {
    document.getElementById('itemsPpage').style.visibility='hidden';
  }
}
//****end of hide the product thumbnails dropdown****
/////////////////////////////////
function drpweb_colorProductShow()
{
  var web_price = document.getElementById('ITEM.SWATCHCOLORS');
  if ( web_price != null)
  {
   document.getElementById('ITEM.SWATCHCOLORS').style.visibility='visible';
  }
}
function drpweb_sizeProductShow()
{
  var web_size = document.getElementById('ITEM.SIZES');
  if ( web_size != null)
  {
   document.getElementById('ITEM.SIZES').style.visibility='visible';
  }
}
function drpweb_qtyProductShow()
{
  var web_size = document.getElementById('ITEM.SINGLEQTY');
  if ( web_size != null)
  {
   document.getElementById('ITEM.SINGLEQTY').style.visibility='visible';
  }
}
function drpweb_colorProductHide()
{
 var web_size = document.getElementById('ITEM.SWATCHCOLORS');
 if ( web_size != null)
  {
    document.getElementById('ITEM.SWATCHCOLORS').style.visibility='hidden';
    //alert ("drpweb_sizeHide");
  }
}
function drpweb_sizeProductHide()
{
 var web_size = document.getElementById('ITEM.SIZES');
 if ( web_size != null)
  {
    document.getElementById('ITEM.SIZES').style.visibility='hidden';
    //alert ("drpweb_sizeHide");
  }
}
function drpweb_qtyProductHide()
{
 var web_size = document.getElementById('ITEM.SINGLEQTY');
 if ( web_size != null)
  {
    document.getElementById('ITEM.SINGLEQTY').style.visibility='hidden';
    //alert ("drpweb_sizeHide");
  }
}
//****this is for the cacique intimate page drop down****
function link()
{
   	str_style = obj.options[obj.selectedIndex].value;
   	//alert(str_style);
   	strurl = str_style;
  	location.href=strurl;
}
function refreshshopby()
{
   	obj = document.caciqueform.Silho;
	link();

    //obj = document.caciqueform.style;
    //str_style = obj.options[obj.selectedIndex].value;
    //alert(str_style);
    //strurl = str_style;
   //location.href=strurl;
  //alert(document.caciqueform.price);
}
function refreshFabric()
{
    obj = document.caciqueform.Fabric;
    link();
}
function refreshCollect()
{
    obj = document.caciqueform.Collect;
    link();
}
function refreshStyles()
{
    obj = document.caciqueform.Styles;
    link();
}
function refreshFragran()
{
    obj = document.caciqueform.Fragran;
    link();
}
function refreshProducts()
{
    obj = document.caciqueform.Products;
    link();
}
function refreshPanSize()
{
   	obj = document.caciqueform.panSize;
   	link();
}
function refreshColor()
{
   	obj = document.caciqueform.color;
   	link();
}
//****end of  cacique intimates page drop down****

//generic popup //
//set URL, height, width, scrollbar
function popup_URLHWS(URL,HEIGHT,WIDTH,SCROLLBAR){
			 window.open(URL,"blank","scrollbars=" + SCROLLBAR + ",toolbar=no,directories=no,menubar=no,resizable=yes,status=no,width=" + WIDTH + ",height=" + HEIGHT);
}

//***shop by size pop up***
function shopbysize_close(){

	opener.document.location.href="size_chart_main";
	window.close();

}
//***shop by size pop up***
// -->
<!---end here-->

// Bridal Roll Over
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//these are the pure, jscripts. no extra Dreamweaver code like above. Matt H 8/14 //

function imageChange() {
	//alert(imageChange.arguments[0] + ' & ' + imageChange.arguments[1]);
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<imageChange.arguments.length; i+=2) {
                        document[imageChange.arguments[i]].src = imageChange.arguments[i+1];
                }
        }
}

var i = 0;
var preloadFlag = false;

function preloadImages(){
	if (document.images){
		if(!document.PreloadedImages) {
		document.PreloadedImages=new Array();
		}
		for (i=0;i<preloadImages.arguments.length;i++){
		document.PreloadedImages[i]=new Image()
		document.PreloadedImages[i].src=preloadImages.arguments[i]
		}
	preloadFlag = true;
	}
}

// Right Fit
function right_fit_results_redirect(){
	var waist_size = document.getElementById("waist_size").value;
	var hip_range = document.getElementById("hip_range").value;
	var message = "none";
	if (waist_size == "none") message = "You must first select your waist size.";
	else
	if (hip_range == "none") message = "You must select your hip range.";
	if (message == "none")
		window.location.href = "InputHandler/right_fit_results?WAIST=" + waist_size + "&HIP=" + hip_range;
	else
		alert(message);
}

function right_fit_results_redirect_popup(rf_color){
	var waist_size = document.getElementById("waist_size").value;
	var hip_range = document.getElementById("hip_range").value;
	var message = "none";
	if (waist_size == "none") message = "You must first select your waist size.";
	else
	if (hip_range == "none") message = "You must select your hip range.";
	if (message == "none")
	window.location.href = "InputHandler/right_fit_results_popup?WAIST=" + waist_size + "&HIP=" + hip_range + "&right_fit_color=" + rf_color;
	else
		alert(message);
}

function right_fit_waist_results_redirect(COLOR){
	var waist_size = document.getElementById("waist_size").value;
	var message = "none";
	if (waist_size == "none") message = "You must first select your waist size.";
	if (message == "none")
		window.location.href = "InputHandler/right_fit_results?WAIST=" + waist_size + "&COLOR=" + COLOR;
	else
		alert(message);
}

function change_hip_dd(){
	var yellow_min, yellow_max, red_min, red_max, blue_min, blue_max, x_min, x_max, show_option="";
	var waist_size = document.getElementById("waist_size").value;
	var hip_range = document.getElementById("hip_range").value;
		if (waist_size != "none"){
			yellow_min = parseInt(waist_size) + 2; yellow_max = parseInt(waist_size) + 5;
			red_min = parseInt(waist_size) + 6; red_max = parseInt(waist_size) + 9;
			blue_min = parseInt(waist_size) + 10; blue_max = parseInt(waist_size) + 13;
			document.getElementById("hip_range_block").innerHTML = "<select id=\"hip_range\" name=\"HIP\" class=\"regstandardtext\" style=\"width:161px;\"><option value=\"none\">Select your hip range</option><option value=\"" + yellow_min + "-" + yellow_max + "\">" + yellow_min + "-" + yellow_max + "\"</option><option value=\"" + red_min + "-" + red_max + "\">" + red_min + "-" + red_max + "\"</option><option value=\"" + blue_min + "-" + blue_max + "\">" + blue_min + "-" + blue_max + "\"</option></select>";
		}else{
			for (x=32;x!=56;x+=2){
				x_min = x + 4; x_max = x + 7;
				show_option = show_option + "<option value=\"" + x_min + "-" + x_max + "\">" + x_min + "-" + x_max + "\"</option>";
				}
				document.getElementById("hip_range_block").innerHTML = "<select id=\"hip_range\" name=\"HIP\" disabled=\"disabled\" class=\"regstandardtext\" style=\"width:161px;\"><option value=\"none\">Select your hip range</option>" + show_option + "</select>";
		}
}

function change_waist_dd(){
	var waist_size_change, yellow, red, blue, show_option="";
	var waist_size = document.getElementById("waist_size").value;
	var hip_range = document.getElementById("hip_range").value;
	if (waist_size == "none"){
		if (hip_range != "none"){
			yellow = parseInt(hip_range) - 2;
			red = parseInt(hip_range) - 6;
			blue = parseInt(hip_range) - 10;
			if (blue >= 34){show_option = show_option + "<option value=\"" + blue + "\">" + blue + "&quot;</option>";}
			if (red >= 34){show_option = show_option + "<option value=\"" + red + "\">" + red + "&quot;</option>";}
			if (yellow >= 34){show_option = show_option + "<option value=\"" + yellow + "\">" + yellow + "&quot;</option>";}
			document.getElementById("waist_size_block").innerHTML = "<select id=\"waist_size\" name=\"WAIST\" onchange=\"javascript:change_hip_dd();\"><option value=\"none\">Select your waist size</option>" + show_option + "</select>";
		} else {
			for (x=34;x!=50;x+=2){
					show_option = show_option + "<option value=\"" + x + "\">" + x + "&quot;</option>";
				}
			document.getElementById("waist_size_block").innerHTML = "<select name=\"HIP\"><option value=\"none\">Select your waist size</option>" + show_option + "</select>";
		}
	}else{
		yellow = parseInt(hip_range) - 2;
		red = parseInt(hip_range) - 6;
		blue = parseInt(hip_range) - 10;
		if (blue >= 34) if (blue == waist_size)show_option = show_option + "<option value=\"" + blue + "\" selected>" + blue + "&quot;</option>";
		if (red >= 34) if (red == waist_size)show_option = show_option + "<option value=\"" + red + "\" selected>" + red + "&quot;</option>";
		if (yellow >= 34) if (yellow == waist_size)show_option = show_option + "<option value=\"" + yellow + "\" selected>" + yellow + "&quot;</option>";
		document.getElementById("waist_size_block").innerHTML = "<select id=\"waist_size\" name=\"WAIST\" onchange=\"javascript:change_hip_dd();\"><option value=\"none\">Select your waist size</option>" + show_option + "</select>";
	}
}
function om_split (str) {
	tempArray = str.split("^")
	var arLen = tempArray.length;
	for( var x=0, len=arLen; x<len; ++x){
		var str = tempArray[x];
		str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
		while (ws.test(str.charAt(--i)));
		tempArray[x] = str.slice(0, i + 1);
	}
	return tempArray;
}