// BEGIN: Generic functions from Macromedia
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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
// END: Generic functions from Macromedia

// BEGIN: Elegant content resizing by Simon Collison http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/
wraphandler = {
  init: function() {
    if (!document.getElementById) return;
    // set up the appropriate wrapper
    wraphandler.setWrapper();
    // and make sure it gets set up again if you resize the window
    wraphandler.addEvent(window,"resize",wraphandler.setWrapper);
  },

  setWrapper: function() {
    // width stuff from ppk's evolt.org/article/document_body_doctype_switching_and_more/17/30655/index.html
    var theWidth = 0;
    if (window.innerWidth) {
	theWidth = window.innerWidth
    } else if (document.documentElement &&
                document.documentElement.clientWidth) {
	theWidth = document.documentElement.clientWidth
    } else if (document.body) {
	theWidth = document.body.clientWidth
    }
    if (theWidth != 0) {
      if (theWidth < 960) {
        document.getElementById('sidebarRight').className = 'barWide';
		document.getElementById('wrapper').className = 'containerNarrow';
      } else {
        document.getElementById('sidebarRight').className = 'barNarrow';
		document.getElementById('wrapper').className = 'containerWide';
      }
    }
  },

// addEvent stuff from John Resig's ejohn.org/projects/flexible-javascript-events
  addEvent: function( obj, type, fn ) {
    if ( obj.attachEvent ) {
      obj['e'+type+fn] = fn;
      obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
      obj.attachEvent( 'on'+type, obj[type+fn] );
    } else {
      obj.addEventListener( type, fn, false );
    }
  }
}

wraphandler.addEvent(window,"load",wraphandler.init);
// END: Elegant content resizing by Simon Collison


// BEGIN: Image and URL switcher
// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com
// Original:  ShuvoRim (shuvorim@hotmail.com )
// Web Site:  http://www.shuvorim.tk

var urlArray = new Array(5); //for URL's, increase size as necessary
var exArray = new Array(5); //for example images, increase size as necessary
var exCounter = 1;
var url = "projects-print.php"; //initial URL

//add your necessary URL's
urlArray[0] = "projects-print.php";
urlArray[1] = "projects-misc.php";
urlArray[2] = "projects-multimedia.php";
urlArray[3] = "projects-misc.php";
urlArray[4] = "projects-print.php";

if(document.images) //pre-load all example images
{
  for(i = 0; i < 5; i++)
  {
    exArray[i] = new Image(40, 40);
    exArray[i].src = "images2/img-x-" + (i+1) + ".gif";
  }
}

function changeExample() //example image changer function
{
  if(exCounter > 4)
  	exCounter = 0;
	document.example.src = exArray[exCounter].src; //sets a new example image
	url = urlArray[exCounter]; //sets a new URL to the example image
	exCounter++; //increase the counter for the next example image
}
//calls the changeExample() function every 3 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var exTimer = window.setInterval("changeExample()", 3000);

/* author@ShuvoRim
 * http://www.shuvorim.tk/
 * shuvorim@hotmail.com
 * (c)ShuvoRim Pvt. Ltd. 2002 -03
 * All rights reserved.
 * --------------------------------------------------
 * visit our web site for more free Java applications
 * and applets. Thank you for using our program.
 * --------------------------------------------------
 */
// END: Image and URL switcher

// BEGIN: E-mail Address Resolver
function emailShow() {
document.write(
'<a hre'+
'f="ma'+
'ilto'+
':'+
'&#105;&#110;&#102;&#111;&#64;&#97;&#114;c&#104;ife&#120;&#105;&#110;&#99;.&#99;&#111;&#109;"'+
'class="linkBlue2"'+
'onMouseOut="MM_swapImgRestore()"'+
'onMouseOver="MM_swapImage'+
'(&#39;bulletMail&#39;,&#39;&#39;,&#39;images2/bg-bullet2-over2.gif&#39;,1)'+
'">Send an e-mail<\/a>');
}
// END: E-mail Address Resolver

// BEGIN: E-mail Address Resolver #2
function emailShow2() {
document.write(
'<a hre'+
'f="ma'+
'ilto'+
':'+
'&#105;&#110;&#102;&#111;&#64;&#97;&#114;c&#104;ife&#120;&#105;&#110;&#99;.&#99;&#111;&#109;?subject=I saw your website"'+
'class="linkBlue2"'+
'">contact Archifex<\/a>');
}
// END: E-mail Address Resolver #2