var HOME_IMAGECOUNT = 10;
var HOME_IMAGEPATH = 'image/rotate/home';
var HOME_IMAGETYPE = '.jpg';

var EDUCATION_IMAGECOUNT = 1;
var EDUCATION_IMAGEPATH = 'image/rotate/education';
var EDUCATION_IMAGETYPE = '.jpg';

var BUSINESS_IMAGECOUNT = 1;
var BUSINESS_IMAGEPATH = 'image/rotate/business';
var BUSINESS_IMAGETYPE = '.jpg';

/*var preLoadedImages = new Array(
)

for (i = 0; i < p; i++){
   preLoadedImages[i] = new Image()
   preLoadedImages[i].src = Pic[i]
}
*/

function generateImageName(strPath, intImageNumber, strFileType){
  return (strPath + intImageNumber + strFileType);
}

function generateRandomImageNumber(intImageCount){
  return (Math.floor(Math.random() * intImageCount) + 1);
}

function setImageSrc(objId, strPath, intImageCount, strFileType){
  var obj = document.getElementById(objId);
  var intImageNumber = generateRandomImageNumber(intImageCount);
  if (obj){
/*    if (obj.id = intImageNumber){
      intImageNumber = (intImageCount - intImageNumber + 1);
    }
    obj.id = intImageNumber;
    obj.src = generateImageName(strPath, obj.id, strFileType);*/
    obj.src = generateImageName(strPath, intImageNumber, strFileType);
  }
}

function setBackground(objId, strBackground){
  var obj = null;
  var e = null;
  if(objId.substr(0, 1) == '<'){
    e = document.getElementsByTagName(objId.substr(1));
  }else{
    obj = document.getElementById(objId);
  }
  if (obj){
    obj.style.background = strBackground;
  }else{
    for(var i=0;i<e.length;i++){
	  e[i].style.background = strBackground;
	}
  }
}

function setVisibility(objId, strVisibility){
  var obj = null;
  var e = null;
  if(objId.substr(0, 1) == '<'){
    e = document.getElementsByTagName(objId.substr(1));
  }else{
    obj = document.getElementById(objId);
  }
  if (obj){
    obj.style.visibility = strVisibility;
  }else{
    for(var i=0;i<e.length;i++){
	  e[i].style.visibility = strVisibility;
	}
  }
}


function showSubmenu(objId, objParent){
  var obj = document.getElementById(objId);
  if (obj){
    if (objParent){
//      alert(objParent.style.position);
      obj.style.position = 'relative';
      obj.top = '300px';
      obj.left = '300px';
      obj.style.display = 'block';
    }else{
      obj.style.display = 'none';
    }
  }
}





	function runSlideShow(objId, strPath, intImageCount, strFileType){
	  var obj = document.getElementById(objId);
  	var t = null;
	  if (obj){
		if (document.all){
			obj.style.filter = "blendTrans(duration=0.25)";
			obj.filters.blendTrans.Apply();
		}
		setImageSrc(objId, strPath, intImageCount, strFileType);
		if (document.all){
		  obj.filters.blendTrans.Play();
		}
		t = setTimeout("runSlideShow('"+objId+"', '"+strPath+"', "+intImageCount+", '"+strFileType+"')", 5000);
	  }
	}

function WriteEmail(pstrUser, pstrDomain, pstrSubject, pstrAfterStartTag, pstrBeforeEndTag) 
  // pierre 5/31/02
  //    avoid email detection scripts
  // Passed:
  //    pstrUser - User that goes before the @
  //        for example: pierre
  //    pstrDomain - Domain that goes after the @, if null, gbprogramming.com will be used
  //        for example: famemaine.com
  //    pstrSubject - Subject of the email, will go after the ?Subject= code in the <a>
  //        for example: Information on prices
  //    pstrAfterStartTag - HTML code you want to insert after the <a> tag
  //        for example: <B>
  //    pstrBeforeEndTag - HTML code you want to insert before the </a> tag
  //        for example: </B>
  // Returns:
  //    the whole email address code, including the <a></a> tags
  {	 
     if (pstrUser != "")
     {
        if (pstrDomain == "")
        {
          pstrDomain = "fa" + "me" + "maine." + "co" + "m";
        }
      
        document.write ("<a href=\"ma" + "ilto:" + pstrUser + "@" + pstrDomain);
        
        if (pstrSubject != "")
        {
            document.write ("?subject=" + pstrSubject);
        }
        
        document.write ("\">" + pstrUser + "@" + pstrDomain + "</a>");	 
    }
  }

function setElementValue(strObjId, strValue){
	var obj = document.getElementById(strObjId);
  if (obj){
    obj.value = strValue;
  }
}