<!--
//#*******************************************************
//#     (The following are required)
//#     @name             mvm.js
//#*******************************************************         
//#     (The following are required)                
//#
//#     @creation date    30 August, 2001
//#     @author           Carl Steele, Lands' End
//#
//#     @purpose          This was cloned form the current US core site and modified for the new .jsp version of the MVM application.
//#                       The purpose of this script is to receive the openMVM or dressModel command from  Net.data and open a daughter
//#                       to determine the status of the mvm fashion servers and dressModel comand for Net.Commerce and open the desired
//#                       MVM window. This script utilizes the mvm_direct.cgi for load balancing and environment control.
//#                       The environment control parameters can be found on mvm_direct.env   
//#*******************************************************
//
// Fashion server url
var mvmUrl = "/cgi-bin/mvm_direct.cgi?";

// isolate the browser version
v = parseInt(navigator.appVersion);
var MVMpopup;

// Open window utilizes the mvm_direct.cgi for load balancing and environment control.
function openWindow(theURL){
        if (v<4){
                var randomIsed = "window" + parseInt(Math.random()*100);
                window.open(mvmUrl+"action=browsermsg",randomIsed,"height=532,width=632");
                return;
        }

        if (!MVMpopup || MVMpopup.closed){
                //document.write(" ** openWindow parm before open = "); 
                //document.write(theURL); 
                MVMpopup=window.open(theURL,"MVMpopup","height=532,width=632,status=0,menubar=0,location=0,resize=0,scrollbars=0"); 
                MVMpopup.focus();
        }
        else{
		if (theURL.indexOf("action=splash") == -1){
	                MVMpopup.location.href=theURL;
		}
                MVMpopup.focus();
        }
}

//  This function is called from the "try it on" button on the product page
function dressModel(sid,gStyle,defclr,gender,cocode){ 
	sid = "&sid=" + sid;
	garment = "&styleNum=" + gStyle;
	defclr = "&defClrCode=" + defclr;
	gender = "&genderCode=" + gender;
	country = "&countryCode=" + cocode;
	theURL = mvmUrl+"action=tryon"+sid+garment+defclr+gender+country;
	openWindow(theURL);
}

// This function is called from the top left navagation bar
function openMVM(sid,cocode){
    sid = "sid=" + sid;
	country = "&countryCode=" + cocode;
	theURL = mvmUrl+"action=splash&"+sid+country;
	openWindow(theURL);
}

//  Call this function from a Fit Enabled Product
function OpenMVMFit(style, gender, country){
//var mvmFitUrl = "http://fit.mvm.com/fit/jsp/views/leus/index.jsp?";
    if (country == 361){
      //var mvmFitUrl = "http://lxapptst04.test.mvm.com:8113/fit/jsp/views/leuk/index.jsp?roc=leuk&v=500i";
      //var mvmFitUrl = "http://fit.mvm.com/fit/jsp/views/leuk/index.jsp?roc=leuk&v=500i"; 
      var mvmFitUrl = "http://leintl.mvm.com/leint_ctx/jsp/handlers/main/mvmfithandler.jsp?action=init&roc=lede&v=500";
    } 
    if (country == 631){
      //var mvmFitUrl = "http://lxapptst04.test.mvm.com:8113/fit/jsp/views/lede/index.jsp?roc=lede&v=500i";
      //var mvmFitUrl = "http://fit.mvm.com/fit/jsp/views/lede/index.jsp?roc=lede&v=500i"; 
      var mvmFitUrl = "http://leintl.mvm.com/leint_ctx/jsp/handlers/main/mvmfithandler.jsp?action=init&roc=lede&v=500";
    } 
        garment = "&g=" + style;
        gender = "&pop=" + gender;
        theFitUrl = mvmFitUrl+garment+gender;
                MVMpopup=window.open(theFitUrl,"MVMpopup","height=532,width=632,status=0")
                MVMpopup.focus();
}

//-->
