// JavaScript Document



function setCookie3(name, value) {
    if (value != null && value != "") {
      newCookie = name + "=" + escape(value) + "; path=/;";
      document.cookie = newCookie;
      bites = document.cookie.split("; "); // update cookie bites
    }
}

var bites = (document.cookie) ? document.cookie.split("; ") : null; // break cookie into array of bites
var fidmname = (bites != null) ? getCookie("fidmname") : null;
var syofc = (bites != null) ? getCookie("syofc") : null;
var myHeight;
var myWidth;
// do I need the webtrends code here, or will that be covered by fclubcommon?

var myquery = document.location.search.substring(1);
if (myquery.indexOf('fromemail') != -1) {
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
	  top.outerWidth=800;
	  top.outerHeight=650;
	} else {
	  if (window.screen.availHeight > 700) {
	    window.resizeTo(800,650);
	  } else {
		window.resizeTo(800,590);
	  }
	}
  }
}



function doscreensaver(what) {
  var pc='http://www.fashionclub.com/perks-and-prizes/downloads/screensavers/debut2004/DEBUT04_PC_Installer.exe';
  var osx='http://www.fashionclub.com/perks-and-prizes/downloads/screensavers/debut2004/DEBUT04_OSX_Installer.sit';
  var os9='http://www.fashionclub.com/perks-and-prizes/downloads/screensavers/debut2004/DEBUT04_OS9_Installer.sit';
  var result = "";
  
  if (what == 'pc') result = pc;
  if (what == 'osx') result = osx;
  if (what == 'os9') result = os9;

  if (result == '') alert('Please select your operating system');
  else window.open(result);
}

function dodesktop(what, res) {
  var errormsg = 'The following error(s) has occurred: \n';
  var e = 0;
  var result="";
  if (what=='') { errormsg += ' - Please select a Desktop \n'; e++; }
  if (res=='') { errormsg += ' - Please select a Screen Resolution \n'; e++; }
  if (e>0) alert(errormsg);
  else { 
    if (what=='1') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/jacobs/' + res + '.jpg';
    if (what=='2') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/posford/' + res + '.jpg';
    if (what=='3') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/samson/' + res + '.jpg';
    if (what=='4') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/tia/' + res + '.jpg';
    if (what=='5') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/chase/' + res + '.jpg';
    if (what=='6') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/bajer/' + res + '.jpg';
    if (what=='7') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/brucker/' + res + '.jpg';
    if (what=='8') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/sun/' + res + '.jpg';
    if (what=='9') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/zeljeznjak/' + res + '.jpg';
    if (what=='10') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/ishioka/' + res + '.jpg';
    if (what=='11') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/campbell/' + res + '.jpg';
    if (what=='12') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/farrell/' + res + '.jpg';
    if (what=='13') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/gonzalez/' + res + '.jpg';
    if (what=='14') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/pineda/' + res + '.jpg';
    if (what=='15') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/debut2004/monroe/' + res + '.jpg';
    window.open(result);
  }
}

function dotheme(what, res) {
  var errormsg = 'The following error(s) has occurred: \n';
  var e = 0;
  var result="";
  if (what=='') { errormsg += ' - Please select a Theme \n'; e++; }
  if (res=='') { errormsg += ' - Please select a Screen Resolution \n'; e++; }
  if (e>0) alert(errormsg);
  else { 
    if (what=='1') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/fashionfile/' + res + '.jpg';
    if (what=='2') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/theDish/' + res + '.jpg';
    if (what=='3') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/skindDeep/' + res + '.jpg';
    if (what=='4') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/careerstudio/' + res + '.jpg';
    if (what=='5') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/perks/' + res + '.jpg';
    if (what=='6') result = 'http://www.fashionclub.com/perks-and-prizes/downloads/desktops/fashionclub/talkback/' + res + '.jpg';
    window.open(result);
  }
}


/*******************************************
 * Switchcurrent - 
 * Highlights the current NAV element
*******************************************/
function switchcurrent(towhat) {
  var img1 = '/myclub/member/images/main-nav_02_on.gif';
  var img2 = '/myclub/member/images/main-nav_03_on.gif';
  var img3 = '/myclub/member/images/main-nav_04_on.gif';
  var img4 = '/myclub/member/images/main-nav_05_on.gif';
  var img5 = '/myclub/member/images/main-nav_06_on.gif';
  if (towhat != "") {
    if (towhat == 'ideacentral') { document.getElementById('Image1').src = img1; }
	if (towhat == 'downloads') { document.getElementById('Image2').src = img2; }
	if (towhat == 'directory') { document.getElementById('Image3').src = img3; }
	if (towhat == 'resources') { document.getElementById('Image4').src = img4; }
	if (towhat == 'help') { document.getElementById('Image5').src = img5; }
  }
}



function change(id, newClass) {
	identity=document.getElementById(id);
	if (identity.className != newClass) {
	  identity.className=newClass;
	}
}
function resetall() {
  // hide all sub-sections
  change('sec1sub', 'level2hid');
  change('sec2sub', 'level2hid');
  change('sec3sub', 'level2hid');
  change('sec4sub', 'level2hid');
  // close all arrows
  change('sec1', 'level1closed');	
  change('sec2', 'level1closed');	
  change('sec3', 'level1closed');		
  change('sec4', 'level1closed');	
}
function section1() {
  resetall();
  change('sec1sub', 'level2vis');	// open this sub-section
  change('sec1', 'level1open');		// change the arrow on this one
}
function section2() {
  resetall();
  change('sec2sub', 'level2vis');	// open this one
  change('sec2', 'level1open');		// change the arrow on this one
}
function section3() {
  resetall();
  change('sec3sub', 'level2vis');	// open this one
  change('sec3', 'level1open');		// change the arrow on this one
}
function section4() {
  resetall();
  change('sec4sub', 'level2vis');	// open this one
  change('sec4', 'level1open');		// change the arrow on this one
}


function resetresourcetools() {
  // hide all sub-sections
  change('sec1sub', 'level2hid');
  change('sec2sub', 'level2hid');
  change('sec3sub', 'level2hid');
  // close all arrows
  change('sec1', 'level1closed');	
  change('sec2', 'level1closed');	
  change('sec3', 'level1closed');
}
function resourcetools1() {
  resetresourcetools();
  change('sec1sub', 'level2vis');	// open this sub-section
  change('sec1', 'level1open');		// change the arrow on this one
}
function resourcetools2() {
  resetresourcetools();
  change('sec2sub', 'level2vis');	// open this one
  change('sec2', 'level1open');		// change the arrow on this one
}
function resourcetools3() {
  resetresourcetools();
  change('sec3sub', 'level2vis');	// open this one
  change('sec3', 'level1open');		// change the arrow on this one
}



// Explanation of how this works is on the Intranet under Fashion Club Help
function dothelanding() {
	var mypaths = new Array();
	mypaths[mypaths.length] = 'http://fashionclub.com/myclub/member/land2.html';
	//mypaths[mypaths.length] = '/myclub/member/';
	//mypaths[mypaths.length] = '/myclub/member/index.html';
	
	//var pathflag = 'bad';
	//for (i=1; i<mypaths.length; i++) { 
	  //alert('setpath=' + mypaths[i] + ', the actual path is: ' + top.window.location.pathname); 
	//  if (top.window.location.pathname == mypaths[i]) { 
	//    pathflag = 'good'; 
	//  } 
	//} 
	//if (pathflag == 'good') {
	  setCookie3('myclub', '1');
	  document.location = mypaths[0];
	//} else {
	//  top.document.location = 'http://www.fashionclub.com/myclub/member/index.html';
	//}
}

// Explanation of how this works is on the Intranet under Fashion Club Help
function dothelanding2() {
	var mypaths = new Array();
	mypaths[mypaths.length] = 'http://www.fashionclub.com/myclub/member/second-home.shtm';
	//mypaths[mypaths.length] = '/myclub/member/';
	//mypaths[mypaths.length] = '/myclub/member/index.html';
	
	//var pathflag = 'bad';
	//for (i=1; i<mypaths.length; i++) { 
	  //alert('setpath=' + mypaths[i] + ', the actual path is: ' + top.window.location.pathname); 
	//  if (top.window.location.pathname == mypaths[i]) { 
	//    pathflag = 'good'; 
	//  } 
	//} 
	
	//pathflag = 'good'; // cheat. don't do the check. 
	
	//if (pathflag == 'good') {
	  setCookie3('myclub', '1');
	  document.location = mypaths[0];
	//} else {
	//  top.document.location = 'http://www.fashionclub.com/myclub/member/index.html';
	//}
}


