// ################################
// Random Image on Refresh http://javascript.internet.com/image-effects/random-image-script.html
// ================================

// Set up the image files to be used.
var SamMED = new Array() // do not change this
var SamSML = new Array() // do not change this

// To add more image files, continue with the
// pattern below, adding to the array. Rememeber
// to increment the SamMED[x] index!

//==== MED Pics Of Sam =====

SamMED[0] = '/images/photos/sam/Tanktop_MED.jpg'
SamMED[1] = '/images/photos/sam/SuitHead_med.gif'
SamMED[2] = '/images/photos/sam/casual_standing_smiling_MED.jpg'
SamMED[3] = '/images/photos/sam/SuitHead_med.gif'
SamMED[4] = '/images/photos/sam/white_seated_cool_MED.jpg'

//==== SML Pics Of Sam =====

SamSML[0] = '/images/photos/sam/Tanktop_SML.gif'
SamSML[1] = '/images/photos/sam/SuitHead_sml2.gif'
SamSML[2] = '/images/photos/sam/casual_standing_smiling_SML.jpg'
SamSML[3] = '/images/photos/sam/SuitHead_sml2.gif'
SamSML[4] = '/images/photos/sam/white_seated_cool_SML.jpg'

// ======================================
// do not change anything below this line
// ======================================

//==== MED Pics Of Sam =====
var j = 0
var p = SamMED.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = SamMED[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showSamMED(){
document.write('<img src="'+SamMED[whichImage]+'">');
}

//==== SML Pics Of Sam =====
var j = 0
var p = SamSML.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = SamSML[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showSamSML(){
document.write('<img src="'+SamSML[whichImage]+'">');
}

//-->



// ################################
// POP UP AUTO CENTER http://www.dynamicdrive.com/dynamicindex8/popwin.htm
// ================================
	var win=null;
	function NewWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);}

// this one is resizable
	var win=null;
	function NewWindowOrder(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);}

// This is a general one used in the menu navigator. Goes something like this:
// href="javascript:popWindow('http://www.miracleburn.com/gc/guarantee.htm','guarantee','scrollbars=yes,resizable=yes,width=550,height=400')"
// or for DHTML menu, use javascript:popWindow('link.html','pop','scrollbars=yes,resizable=yes,width=600,height=500')

	function popWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

// ################################
// bookmark a page
// used at http://www.webmd.com/
// specific script at http://a876.g.akamai.net/7/876/1448/v00002/images.webmd.com/images/mywebmd/frameworkRedesign/chrome_scripts.js
// ================================

	function Bookmark() {
	  /* quick check of the browser and OS */
	  var agt=navigator.userAgent.toLowerCase();

	  /*** PLATFORM ***/
	  var is_win = (agt.indexOf('windows')!=-1);
	  var is_mac = (agt.indexOf('mac')!=-1);

	  /*** BROWSER ***/
	  var is_ie     = (agt.indexOf('msie') != -1);
	  var is_firefox = (agt.indexOf('firefox') != -1);
	  var is_netscape  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('compatible') == -1));
	  var is_safari = ((agt.indexOf('safari')!=-1)&&(is_mac));

	  if (is_win) {
	    if (is_ie && window.external) {
	      window.external.AddFavorite(location.href,document.title);
	    }
	    else {
	      if (is_firefox) {
		alert('Please press CTRL + D to bookmark this page.');
	      }
	      else {
		if (is_netscape) {
		  alert('Please press CTRL + D to bookmark this page.');
		}
		else {
		  alert('Please press CTRL + D to bookmark this page.');
		}
	      }
	    }
	  }
	  else {
	    if (is_mac) {
	      if (is_ie && window.external) {
		window.external.AddFavorite(location.href,document.title);
	      }
	      else {
		if (is_safari) {
		  alert('Please press Command (Apple) + D to bookmark this page.');
		}
		else {
		  alert('Please press UP arrow + Command (Apple) + D to bookmark this page.');
		}
	      }
	    }
	    else {
	      alert('Please press CTRL + D to bookmark this page.');
	    }
	  }
	  return false;
	}


// ################################
//For Running Active Content in IE6
//http://www.adobe.com/devnet/activecontent/articles/devletter.html
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
// ================================

	function AC_AddExtension(src, ext)
	{
	  if (src.indexOf('?') != -1)
	    return src.replace(/\?/, ext+'?'); 
	  else
	    return src + ext;
	}

	function AC_Generateobj(objAttrs, params, embedAttrs) 
	{ 
	  var str = '<object ';
	  for (var i in objAttrs)
	    str += i + '="' + objAttrs[i] + '" ';
	  str += '>';
	  for (var i in params)
	    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
	  str += '<embed ';
	  for (var i in embedAttrs)
	    str += i + '="' + embedAttrs[i] + '" ';
	  str += ' ></embed></object>';

	  document.write(str);
	}

	function AC_FL_RunContent(){
	  var ret = 
	    AC_GetArgs
	    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	     , "application/x-shockwave-flash"
	    );
	  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
	}

	function AC_SW_RunContent(){
	  var ret = 
	    AC_GetArgs
	    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
	     , null
	    );
	  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
	}

	function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
	  var ret = new Object();
	  ret.embedAttrs = new Object();
	  ret.params = new Object();
	  ret.objAttrs = new Object();
	  for (var i=0; i < args.length; i=i+2){
	    var currArg = args[i].toLowerCase();    

	    switch (currArg){	
	      case "classid":
		break;
	      case "pluginspage":
		ret.embedAttrs[args[i]] = args[i+1];
		break;
	      case "src":
	      case "movie":	
		args[i+1] = AC_AddExtension(args[i+1], ext);
		ret.embedAttrs["src"] = args[i+1];
		ret.params[srcParamName] = args[i+1];
		break;
	      case "onafterupdate":
	      case "onbeforeupdate":
	      case "onblur":
	      case "oncellchange":
	      case "onclick":
	      case "ondblClick":
	      case "ondrag":
	      case "ondragend":
	      case "ondragenter":
	      case "ondragleave":
	      case "ondragover":
	      case "ondrop":
	      case "onfinish":
	      case "onfocus":
	      case "onhelp":
	      case "onmousedown":
	      case "onmouseup":
	      case "onmouseover":
	      case "onmousemove":
	      case "onmouseout":
	      case "onkeypress":
	      case "onkeydown":
	      case "onkeyup":
	      case "onload":
	      case "onlosecapture":
	      case "onpropertychange":
	      case "onreadystatechange":
	      case "onrowsdelete":
	      case "onrowenter":
	      case "onrowexit":
	      case "onrowsinserted":
	      case "onstart":
	      case "onscroll":
	      case "onbeforeeditfocus":
	      case "onactivate":
	      case "onbeforedeactivate":
	      case "ondeactivate":
	      case "type":
	      case "codebase":
		ret.objAttrs[args[i]] = args[i+1];
		break;
	      case "width":
	      case "height":
	      case "align":
	      case "vspace": 
	      case "hspace":
	      case "class":
	      case "title":
	      case "accesskey":
	      case "name":
	      case "id":
	      case "tabindex":
		ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
		break;
	      default:
		ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
	    }
	  }
	  ret.objAttrs["classid"] = classid;
	  if (mimeType) ret.embedAttrs["type"] = mimeType;
	  return ret;
	}


// ################################
// Display PNG image fix for MSIE
// ================================

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);



