//
// insert the inline code here !!!!!!!!!
//

var pForm = navigator.userAgent;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);

var HImage = new Image();
var menuLayer;
var menuName;

// check if using a Macintosh

if (pForm.indexOf("Mac")!=-1) {
	//alert("Mac");
	if (bName == "Netscape")  {
	//alert("Netscape Macintosh");
	//document.write(	'<LINK REL="STYLESHEET" HREF="styles.css">');
	}
	else
	{
	//alert("MSIE");
	//document.write(	'<LINK REL="STYLESHEET" HREF="macstyles.css">');
	}
 }
else  {
	//alert("Not MAC");
	//document.write(	'<LINK REL="STYLESHEET" HREF="opestyles.css">');
 }


function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  if(document.getElementById){
   for (i=0; i<(args.length-1); i+=2){
   obj=document.getElementById(args[i]);v=args[i+1];
v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;
   }
  }
  else{
  for (i=0; i<(args.length-1); i+=2) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+1];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
 }
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-1);i+=2)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+1];}
}

function clrCapt() {
	//alert("Clear");
	window.setTimeout('clrCapt()',2000);
MM_showHideLayers('iHome','hide','Home1','hide','iHistory','hide','History1','hide','iMenswear','hide','Menswear1','hide','iFormal','hide','Formal1','hide','iSchool','hide','School1','hide','iTailor','hide','Tailor1','hide');
MM_showHideLayers('iSeason','hide','Season1','hide','iShoes','hide','Shoes1','hide','iAccessory','hide','Accessory1','hide','iHints','hide','Hints1','hide','iLinks','hide','Links1','hide');

}
function showMenu(menu,menulayer,buttonImage, buttonImageFile) {
// First show the required menu and then add the transparent menu layer plus the underlying menucloser layer
MM_showHideLayers(menu,'show',menulayer,'show','menucloser','show');
// set the global variable for when layer is restored
menuLayer = menulayer;
menuName = menu;
HImage=buttonImage;
if (buttonImage.src) {
		buttonImage.src=buttonImageFile;
		HImage.src=buttonImage.src	
	};
}

function hideMenu(menu,menulayer,buttonImage, buttonImageFile) {
// First show the required menu and then add the transparent menu layer plus the underlying menucloser layer
MM_showHideLayers(menu,'hide',menulayer,'hide','menucloser','hide');
if (buttonImage.src) {
		buttonImage.src=buttonImageFile;
	};
}
function preloadImages() {
    var theImages = new Array;
    for(i=0; i<preloadImages.arguments.length; i++) {
      theImages[i] = new Image();
		//alert(preloadImages.arguments[i]);
		theImages[i].src = preloadImages.arguments[i];
    }
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function clrPics( pIMG) {
	MM_showHideLayers(pIMG,'hide');
}

function showCalendar(linkURL, dateVal, firstDate)
{
     if (dateVal) { 
		 if (dateVal.value===undefined)
		 {
			 linkURL = linkURL + dateVal;
		 } else {
			 linkURL = linkURL + dateVal.value; 
		 }
	 }
	 if (firstDate)
	 {
		 if (firstDate.value===undefined)
		 {
			linkURL = linkURL + '&firstdate=' + firstDate;
		 } else {
			linkURL = linkURL + '&firstdate=' + firstDate.value;
		 }
	 }
     window.open ( linkURL,'calendar',"height=263,width=220,left=380,top=280,toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes");
     return false;
}

var progressWindow;

function showPopup( linkURL, height, width, top, left, popup )
{
	if (height==null)
	{
		height=400;
	}
	if (width==null)
	{
		width=400;
	}
	if (top==null)
	{
		top = 10;
	}
	if (left==null)
	{
		left = 10;
	}
	if (popup==null)
	{
		popup = '7starpopup';
	}
	thiswindow = window.open ( linkURL, popup, "height="+height+", width="+width+",left="+left+",top="+top+", screenX=50, screenY=50, toolbar=no,location=no, menubar=no, directories=no, status=no, scrollbars=yes, resizable=yes, copyhistory=no");
	if (thiswindow==null)
	{
		alert("popup windows are disabled!");
		return true;
	} else {
		progressWindow = thiswindow;
	}
	// if browser does not support move then window will be top left corner
	thiswindow.moveTo((screen.width-width)/2,0)
	//thiswindow.moveTo((screen.width-width)/2,(screen.height-height)/2); 
	return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showProgress( ) 
{
	showPopup('progress.htm', 135, 465,0,0,'progress');
}

function reportProgress( percent )
{
	if (progressWindow!=null)
	{
		progressWindow.printBar(percent);
	}
}

// function getStyleObject(string) -> returns style object
//  given a string containing the id of an object
//  the function returns the stylesheet of that object
//  or false if it can't find a stylesheet.  Handles
//  cross-browser compatibility issues.
//
function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
    return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
    return document.layers[objectId];
   } else {
    return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
    styleObject.display = newVisibility;
    return true;
    } else {
    // we couldn't find the object, so we can't change its visibility
    return false;
    }
}

function getObjectVisibility(objectId) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
    getVisibility = styleObject.display  ;
	return getVisibility;
    } else {
    // we couldn't find the object, so we can't change its visibility
    return 'none';
    }
}

//function toggleVisibility(objectId, DispModes ) {
function toggleVisibility() {
  var i,j,p,v,obj,args=toggleVisibility.arguments;

   for (j=0; j<(args.length-1); j+=2){
      //objectId=document.getElementById(args[j]);DispModes=args[j+1];
      objectId=args[j];DispModes=args[j+1];

	  var currVisibility = getObjectVisibility(objectId);
	  //alert(DispModes);
	  //alert(objectId.name);

	  var DispArr = DispModes.split(":"); // this should only contain block: none : inline
	  LimitNr = DispArr.length;

	  notFound = true;
	  i = 0;
	  while ((i<LimitNr) && ( notFound=true) )
	  {
		//alert(DispArr[i]);
		if (DispArr[i]==currVisibility)
		{ 
			notFound = false;
			break;
		}
		i= i+1;
	  }
	  i = (i+1) % LimitNr;
	  changeObjectVisibility(objectId, DispArr[i]);
   }
   return true;
}

//function toggleVisibility(objectId, DispModes ) {
function setVisibility() {
  var i,j,p,v,obj,args=setVisibility.arguments;

   DispModes=args[0];
   for (j=1; j<(args.length); j+=1){
      //objectId=document.getElementById(args[j]);DispModes=args[j+1];
      objectId=args[j];

	  var currVisibility = getObjectVisibility(objectId);
	  //alert(DispModes);
	  //alert(objectId.name);

	  var DispArr = DispModes.split(":"); // this should only contain block: none : inline
	  LimitNr = DispArr.length;

	  notFound = true;
	  i = 0;
	  while ((i<LimitNr) && ( notFound=true) )
	  {
		//alert(DispArr[i]);
		if (DispArr[i]==currVisibility)
		{ 
			notFound = false;
			break;
		}
		i= i+1;
	  }
	  i = (i+1) % LimitNr;
	  changeObjectVisibility(objectId, DispArr[i]);
   }
   return true;
}

function rowOverEffect(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function shiftOpacity(id, millisec) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.opacity == 0) {
        opacity(id, 0, 100, millisec);
    } else {
        opacity(id, 100, 0, millisec);
    }
} 

function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    
    //make image transparent
    changeOpac(0, imageid);
    
    //make new image
    document.getElementById(imageid).src = imagefile;

    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
}

function currentOpac(id, opacEnd, millisec) {
    //standard opacity is 100
    var currentOpac = 100;
    
    //if the element has an opacity set, get it
    if(document.getElementById(id).style.opacity < 100) {
        currentOpac = document.getElementById(id).style.opacity * 100;
    }

    //call for the function that changes the opacity
    opacity(id, currentOpac, opacEnd, millisec)
} 
