// All code here is Copyright {*} Redshift unless otherwise stated.
// You are welcome to use this as long as you keep this header with it.
// Rudolf Vavruch. rudolf@redshift.co.za

// here is the stuff that controls pop-up windows for all the artical pages.
// some code must be added to each page as well to work properly

function imgObject (w, h, nm, t, alt) {
  // this creates an imgObject which contains information about the big picture
  // they are intitialsed on each separate pagehttp://localhost/Redshift/dindaba/images/banner06_1stq.png
  this.width = w;
  this.height = h;
  this.name = nm;
  this.type = t;
  this.alttag = alt;
}

function imgArrayHolder (a) {
  this.pageArray = a;
}

var currpopup = false;

function popupImage (which) {  
  // this creates the pop-up window for the image using information gathered from the ImageArray
  // created in the HTML page
 
  var theWidth = imageArray[which].width;
  var theHeight = imageArray[which].height;
  var popupref = imageArray[which].name;
  
  var popup = window.open("popup.html",popupref, 'toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width='+theWidth+',height='+theHeight);  
  
  currpopup = popup;
  
  popup.focus();
}

//////////////////////////////
/* Non window-popping stuff */
//////////////////////////////
function swpImg(theName, theExt) {
	// A little function I devised that does rollOvers
	theName.src = "images/" + theName.name + theExt
}

function swpImg2(theName, theExt) {
	// A little function I devised that does rollOvers
	theName.src = "../images/" + theName.name + theExt
}

function subSwpImg(theName, theExt) {
	// A little function I devised that does rollOvers
	theName.src = "../../images/" + theName.name + theExt
}

// a function I ripped from the original file to preload images. from Fireworks program	
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];
			}
		}
	}
}

// goto Current Issue
function goCurrent() {
	location = "http://www.designindaba.com/media/magazine";
	
}


/*// make sideMenu
function createMenu(myLvl,posi) {
	linkArray = ["2009/1st/index.htm"];//include current issue for the year here
	
	snip01 = "<tr><td>";
	snipA01 = "<a href=\"";
	snipA02 = "\" onMouseOver=\"";
	snipA03 = "(document.quarter0";
	snipA04 = ", '-on.gif');\" onMouseOut=\"";
	snipA05 = "(document.quarter0";
	snipA06 = ", '-off.gif');\">";
	snip02 = "<img src=\"";
	snip03 = "images/quarter0";
	snip04a = ".gif\" width=\"105\" height=\"17\"";
	snip04b = ".gif\" width=\"105\" height=\"14\"";
	snip05 = "\" name=\"quarter0";
	snip06 = "\" border=\"0\">";
	snipA07 = "</a>";
	snip07 = "</td></tr>";
	
	//lvl1 = "../";
	//lvl2 = "../../";
	
	lvl = "";
	func = "swpImg";
	
	// find the folder level
	if (myLvl > 0) {
		lvl = "../";
		func = "swpImg2";
		if (myLvl == 2) {
			lvl += "../";
			func = "subSwpImg";
		}
	}
	
	for (i=0; i<4; i++) {//increase the iteration here to accommodate nos of issues for the year
		
		num = i + 1;
		
		tempStr = "";
		
		// find the height of the image
		if (i == 0 || i == 4) {
			snip04 = snip04a;
		} else {
			snip04 = snip04b;
		}
		
		// check if it is a stay
		if (posi == i) {
			//<TR><TD><img src="../images/quarter04-stay.gif" width="105" height="14" alt="2nd Quarter" name="quarter04" border="0"></TD></TR>
			tempStr = snip01 + snip02 + lvl + snip03 + num + "-stay" + snip04 + snip05 + num + snip06 + snip07;
			
		} else { // not a stay
			
			// check if it is a dead link
			if (!linkArray[i]) {
				
				//<TR><TD><img src="../images/quarter02-dead.gif" width="105" height="14" alt="2nd Quarter" name="quarter02" border="0"></TD></TR>
				tempStr = snip01 + snip02 + lvl + snip03 + num + "-dead" + snip04 + snip05 + num + snip06 + snip07;
			
			} else { // not a deadlink
				
				// <TR><TD><A href="default012002.htm" onMouseOver="swpImg(document.quarter01, '-on.gif');" onMouseOut="swpImg(document.quarter01, '-off.gif');"><img src="images/quarter01-off.gif" width="105" height="17" alt="1st Quarter" name="quarter01" border="0"></a></TD></TR>
				tempStr = snip01 + snipA01 + lvl + linkArray[i] + snipA02 + func + snipA03 + num + snipA04 + func + snipA05 + num + snipA06 + snip02 + lvl + snip03 + num + "-off" + snip04 + snip05 + num + snip06 + snipA07 + snip07;
				
			}
		}
		document.write(tempStr);
		//alert(tempStr);
	}
	
}*/

