/* On Purpose Design - Site Library */
/* Designed by Andy Schubert, On Purpose Design */
/* Copyright May 2010, On Purpose Design */
/* Created Sunday, May 16, 2010 | Updated Wednesday, June 2, 2010 */
/* JQUERY Library is 57k; this file is only 9k */

function dw(n) {document.write(n);}

function showhide(n) {
var testid = document.getElementById(n).className;
if (testid == "projectbody") {
document.getElementById(n).setAttribute('class','projectbodyhide');
document.getElementById(n).setAttribute('className','projectbodyhide');
	}
else if (testid == "projectbodyhide") {
document.getElementById(n).setAttribute('class','projectbody');
document.getElementById(n).setAttribute('className','projectbody');
	}	
}

function footer() {
dw('<div id="footer"><p>&copy; 2010, On Purpose Design</p></div>');
}

function contactwriter(a,b,c,d) {
var ename=a;
var domain=b;
var ext=c;
var subject=d;

dw('<a href="mailto:'+ename+'@'+domain+'.'+ext+'?subject='+subject+'">'+ename+'@'+domain+'.'+ext+'</a>');
}

function showfeatures(n) {
document.getElementById(n).style.display='block';
document.getElementById(n).style.visibility='visible';
}

function hidefeatures(n) {
document.getElementById(n).style.display='none';
document.getElementById(n).style.visibility='hidden';
}


function storedeftext(n){ // n = save, write
	if (n == 'write') {
	var mysavedcontent = document.getElementById('storage').innerHTML;
		if (document.getElementById('rightcolumn')) {document.getElementById('rightcolumn').innerHTML = mysavedcontent;}
		else if (document.getElementById('bottomcolumn')) {document.getElementById('bottomcolumn').innerHTML = mysavedcontent;}
	}
	else{}
}

function featurizer(m,n) { // m = layout ('ss' for side by side, 'tb' for top-bottom), n = image variable, e.g. 'aaa', 'bbb' 

var count=0;
entity = new Array();

function tt(a, b, c, d, e, f, g, h, i){
 	entity[count]= new Array(8);
 	entity[count].uniqueid=a; // could also be img filename? (assumed jpg?)
 	entity[count].level=b; // primary or thumb
	entity[count].imagetitle=c; // image title; thumb title
	entity[count].hstop=d; // hotspot top
	entity[count].hsleft=e; // hotspot left
	entity[count].imgwidth=f;
	entity[count].imgheight=g;
	entity[count].parentid=h;
	entity[count].textdesc=i;
 	count++;
}
tt('aaa','primary','MSN Assets Grid','0','0','608','772','','Partner placements tracked in an easy to use grid layout. This was part of the intranet I built called \'Matchbox\'. Many more tools and documents are under the other tabs.'); // primary
tt('aaa101','thumb','Tool tabs','54','14','580','114','aaa','These tabs access the large number of tools and documents that I created in support of the International platform.'); // secondary
tt('aaa102','thumb','Other stuff','272','14','447','77','aaa','Users could easily access any asset for each affiliate by clicking on the icons.'); // secondary
tt('aaa103','thumb','More stuff','371','460','142','263','aaa','Countless database lookups (100s of hours) were avoided by having these values available.'); // secondary

tt('bbb','primary','Quick Search Link Finder','0','0','916','272','','Link Finder tool generates complete URL query string ready for exporting to partners.'); // primary
tt('bbb101','thumb','Search Criteria','13','19','310','198','bbb','Internal user completes the search form to establish desired criteria for search results.'); // secondary
tt('bbb102','thumb','Hyperlink Options','4','358','545','50','bbb','Options for generation of a hyperlink (such as the clickable text).'); // secondary
tt('bbb103','thumb','Generated Output','98','358','445','83','bbb','Generated URLs and hyperlink tags can be copied from these fields. Button at the bottom opens the result in a new window.'); // secondary

tt('ccc','primary','Configuration XML Monitor','0','0','916','200','','An large autogenerated XML file was updated regularly, but to know the values, you had to open the file and read through the XML syntax. Not always easy for our business team who did not have server access to the file.'); // primary
tt('ccc101','thumb','Normal Entry','3','158','133','29','ccc','This entry, for Australia, indicates that all settings are normal (green).'); // secondary
tt('ccc102','thumb','Disabled Entry','144','158','133','29','ccc','This entry, for Spain, has the auto-update turned off to allow for A/B testing in market.'); // secondary
tt('ccc103','thumb','Visual Legend','71','681','202','123','ccc','The legend emulates the appearance of the entries and provides an easy to understand guide.'); // secondary

tt('ddd','primary','Article Generated with the Editorial Engine','0','0','916','576','','Built an editorial \'engine\' that presents the layout, the default image, the call-to-action links under the image, and relevant article links and authors, based on the language value passed in the script call.'); // primary
tt('ddd101','thumb','Inline Search','287','107','468','94','ddd','Inline search is displayed using another script engine.'); // secondary
tt('ddd102','thumb','Selectable Stock Image','15','586','229','188','ddd','Market managers could choose from over 100 stock images and select simply by inserting a numeric value in the script call. Built in system allows them to introduce new images to the pool as needed.'); // secondary
tt('ddd103','thumb','Visual Legend','211','586','229','98','ddd','Other features, not displayed, allow for custom linkable images to manage a promotion, or red colored links in the call-to-action listing.'); // secondary
tt('ddd104','thumb','Article Listing','371','586','229','196','ddd','Articles are initially language based and can be filtered by affiliate. This allows custom articles to be displayed for one affiliate and not others, if desired.'); // secondary
var z;

dw('<p class="explain">Mouseover image for hotspots. Mouseover hotspots for details.</p>');

if (m == 'ss') {
dw('<div id="leftcolumn">');
var altcolumn = 'rightcolumn';
}
else if (m == 'tb') {
dw('<div id="topcolumn">');
var altcolumn = 'bottomcolumn';
}

	for(z=0; z <= (entity.length - 1); z++) { // start loop
		if ((n == ''+entity[z].uniqueid)&&(''+entity[z].level == 'primary')) {
			var mainimgdesc = ''+entity[z].textdesc;
			dw('<h1>'+entity[z].imagetitle+'</h1>');
			dw('<div id="showcasebox" style="width:'+entity[z].imgwidth+'px; height:'+entity[z].imgheight+'px;" onmouseover="showfeatures(\'mask\');" onmouseout="hidefeatures(\'mask\')">');
			dw('<img id="mainimg" src="images/screenshots/'+entity[z].uniqueid+'.jpg" width="'+entity[z].imgwidth+'" height="'+entity[z].imgheight+'" />');
			dw('<div id="mask" style="display:none; visibility:hidden; background: transparent url(\'images/mask3.png\') repeat 0px 0px; width:'+entity[z].imgwidth+'px; height:'+entity[z].imgheight+'px;">');			
		}
		else{}
	}
	
	for(z=0; z <= (entity.length - 1); z++) { // start loop
		if ((n == ''+entity[z].uniqueid.substring(0,3))&&(''+entity[z].level == 'thumb')) {
			var tweaktop = parseInt(''+entity[z].hstop)-1;
			var tweakleft = parseInt(''+entity[z].hsleft)-1;
			dw('<a href="#" id="'+entity[z].uniqueid+'" onmouseover="document.getElementById(\''+altcolumn+'\').innerHTML = \'<h2>Hotspot Details</h2><p>'+entity[z].textdesc+'</p>\';" onmouseout="storedeftext(\'write\');" class="hotspot" style="width:'+entity[z].imgwidth+'px; height:'+entity[z].imgheight+'px; background:#FFFFFF url(images/screenshots/'+n+'.jpg) no-repeat -'+entity[z].hsleft+'px -'+entity[z].hstop+'px; top: '+tweaktop+'px; left: '+tweakleft+'px"></a>');
		}

		else{}
	}
			dw('</div>');
			dw('</div>');
dw('</div>'); // end leftcolumn or topcolumn
	
if (m == 'ss') {
dw('<div id="rightcolumn">');
}
else if (m == 'tb') {
dw('<div id="bottomcolumn">');
}

dw('<h1>Image Description</h1><p>'+mainimgdesc+'</p>');
dw('</div>'); // end rightcolumn or bottomcolumn

dw('<div id="storage" style="display:none; visibility:hidden"></div>');
var mysavedcontent = document.getElementById(''+altcolumn+'').innerHTML;
document.getElementById('storage').innerHTML = mysavedcontent;
} // end function


function ss(string) {
return string.split(' ').join('');
}

function globalheader(h, j) {

var count=0;
var entity = new Array();  // initialize Array 

function dc(a, b, c, d){
 	entity[count]= new Array(3);
	entity[count].level=a;
	entity[count].label=b;
 	entity[count].gotolink=c;
 	entity[count].parentref=d;
 	count++;
}

dc('macro','About Me','index.html','');
dc('macro','My Work','proj1.html','');
dc('macro','Recruiters','recruiters.html','');

// Home micro-Tabs // 
dc('micro','Project 1','proj1.html','mywork');
dc('micro','Project 2','proj2.html','mywork');
dc('micro','Project 3','proj3.html','mywork');
dc('micro','Project 4','proj4.html','mywork');
//dc('micro','Project 5','proj5.html','mywork');
//dc('micro','Project 6','proj6.html','mywork');
dc('micro','More Soon...','proj7.html','mywork');


var z;
dw('<div id="header">');
dw('<div id="logo"></div><h1>On Purpose Design</h1><h2>Portfolio of Andy Schubert</h2>');

// Write out Macrotabs // 
if (h == "") {}
else{
dw ('<div id="maintabs">');
	for(z=0; z <= (entity.length - 1); z++) { // start loop
		if (''+entity[z].level == "macro")
		{ 
			var m = entity[z].label.toLowerCase();
			var mm = ss(m);
			dw('<a id="'+mm+'" href="'+entity[z].gotolink+'">'+entity[z].label+'</a>');
		}
		else {}
	} // end loop
dw ('</div>');
		document.getElementById(h).setAttribute("class", "selected");
		document.getElementById(h).setAttribute("className", "selected");
}

// Write out Microtabs, if any // 
if (j == "") {}
else{
dw ('<div id="row2tabs">');
	for(z=0; z <= (entity.length - 1); z++) { // start loop
		if ((''+entity[z].level == "micro")&&(entity[z].parentref == h))
			{	
				var f = entity[z].label.toLowerCase();
				var ff = ss(f); // strip spaces to form hyperlink id value
				dw('<a id="'+ff+'" href="'+entity[z].gotolink+'">'+entity[z].label+'</a>');
			}
		else {}
	} // end loop
dw ('</div>');
		document.getElementById(j).setAttribute("class", "selected");
		document.getElementById(j).setAttribute("className", "selected");
}

dw ('</div>'); // end header
} // end function
