//SCRIPT LANGUAGE="JavaScript"
// woc code 1 2009 universal functions

// fnSENDEUK - hide sensitive data by breaking up text
function fnSendEuk(x,u,a1,s,p,a2)
{
  var cChAt = '&#64;';
  var sObfuscate = '<a';
  sObfuscate += ' href="mailto:' + u + cChAt + a1 + a2;
  sObfuscate += '.' + x;
  sObfuscate += ' ?subject=' + s + '"> ';
  sObfuscate += p + ' </a>';
  document.write(sObfuscate);
}

// fnBANNER - [onload] Creates table code for banner in div id="banner"
//	aImage = "auto-photo" means use a selected image
function fnBanner(aMap,aImage,aStand1,aStand2,aStand3)
{
	var num_off = 27;	// NUMBER of AVAILABLE IMAGES
	var code_in;
	var img_url;
	
// Set image or a default
	img_url = aImage;
	if (img_url == 'auto-photo') { img_url = fnAutoImg("media/woc_banner_", num_off, "", ""); }

	// Table: Row 1: image (3 row), logo and page map
	code_in = '<table><col width=120px><col width=220px><col width=460px>';
	code_in += '<tr><td class="woc" rowspan=3><a href="ix_woc.html">';
		code_in += '<img src="' +	img_url + '"></a></td>';
	code_in += '<td class="logo"><a href="index.html">';
		code_in += '<img align=left src="media/woc_web_logo.gif"></a></td>';
	code_in += '<td valign=bottom class="map">' + aMap + '</td></tr>';
		
	// Row 2: Navigation links (2 cols)
	code_in += '<tr><td colspan=2 class=nav>';
	code_in += '<a href="index.html">Home</a>';
	code_in += '<a href="ix_evt.html">Events</a>';
	code_in += '<a href="ix_top.html">Top-10</a>';
	code_in += '<a href="ix_prj.html">Projects</a>';
	code_in += '<a href="ix_scr.html">Scripts</a>';
	code_in += '<a href="ix_fic.html">Fiction</a>';
	code_in += '<a href="ix_woc.html">WOC&nbsp;biog</a>';
	code_in += '<a href="ix_lnk.html">Contacts</a>';
	code_in += '</td></tr>';
		
	// Row 3: Stand first, up to 3 lines of text (2 cols)
	code_in += '<tr><td colspan=2 class=stand> ';
	if (aStand1 !='') { code_in += aStand1 +' <br />'; }
	if (aStand2 !='') { code_in += aStand2 +' <br />'; }
	if (aStand3 !='') { code_in += aStand3; }
	code_in += '</td></tr>';

	code_in += '</table>';
	code_in += '<hr class="rule">'

	document.getElementById('banner').innerHTML = code_in;
}

// fnAutoImg - [onload] picks (based on time) an image from a range and optionally load it
// aImgUrl=url prefix; aNumber=available to pick from; aFormat=format params
//	aElement=null, or division in which to load the html code
// return=picked url
function fnAutoImg(aImgUrl,aNumber,aFormat,aElement)
{
	var code_in = '';
	var img_url;
	var modulus = aNumber;
	var now = new Date();
	var base = now.getMilliseconds();
	var iImg = (base % modulus) + 1;	// auto-photo file ID range (remainder)
	
	img_url = aImgUrl + iImg + '.jpg';
	if (aElement != '') {
		code_in = '<img src="' + img_url + '" ' + aFormat + '>';
		document.getElementById(aElement).innerHTML = code_in;
		}
	return (img_url);
}

// fnPopupText - [onClick] within an a href target=_blank - to define target size
// For text amd images
function fnPopupText (pUrl, pWidth, pHeight)
{
	var pop_params = 'width=' + pWidth + ', height=' + pHeight;
	pop_params += ', top=0, left=20, scrollbars=yes, resize=yes';

	pop_woc = window.open(pUrl,'pop_woc',pop_params);
//	pop_woc.moveTo(100,80);
}



