
// ===============================================================================
// ===============================================================================
// ===== bookmark page =====
function bookmarksite(title,url){
	if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
// ===============================================================================
// ===============================================================================
// ===== cookies ======
function get_cookie ( cookie_name ){
  	var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  	if ( results )
    		return ( unescape ( results[1] ) );
  	else
    		return null;
}
function backlink(newurl){
	var oldc = get_cookie ( "oldc" );
	var newc = get_cookie ( "newc" );
	if(newc){
		urlname="oldc";
		urlvalue=newc;
		var cookie_string = urlname + "=" + escape ( urlvalue );
		document.cookie = cookie_string;
	}
	if(newurl){
		urlname="newc";
		urlvalue=newurl;
		var cookie_string = urlname + "=" + escape ( urlvalue );
		document.cookie = cookie_string;
	}
}
function goback(){
	var oldc = get_cookie ( "oldc" );
	if(oldc){
		ajaxpage(oldc,'contentarea',0);
	}
}
// ===============================================================================
// ===============================================================================
// ===== portfolio ======
var stepping="";
function portfolio(stepping){
var showhighest=13;
var showcurrent=1;
var laststep = get_cookie ( "portfolio" );
if(laststep>0){
	if(stepping=="ff"){
		laststep++;
		showcurrent=laststep;
	}
	if(stepping=="bb"){
		showcurrent=laststep-1;
	}

}
if(showcurrent>showhighest){
	showcurrent=1;
}
if(showcurrent<1){
	showcurrent=showhighest;
}

pfn="portfolio";
pfv=showcurrent;
var cookie_portfolio = pfn + "=" + escape ( pfv );
document.cookie = cookie_portfolio;

pfurl="portfolio.php?show="+showcurrent;
ajaxpage(pfurl,'portfolio',0);
}
// ===============================================================================
// ===============================================================================
// ===== load page with Ajax ======
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects="";
var rootdomain="http://"+window.location.hostname;
var bustcacheparameter="";
var highlight="";
var setitback=0;



function ajaxpage(url, containerid, setitback2){
setitback=setitback2;
backlink(url);
if(setitback==1){
	colBar.style.visibility = "hidden";
	backBar.style.visibility = "visible";
	backBar.innerHTML = "<a href='#' onclick='goback()'><img src='"+imgPath+"/back.gif' width='12' height='25' border='0'></a>";
}
else{
	backBar.style.visibility = "hidden";
}





var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
	try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
	} 
	catch (e){
		try{
			page_request = new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch (e){}
	}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}

if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)

}

function loadpage(page_request, containerid){

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText

}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){
if (file.indexOf(".js")!=-1){ 
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" "
}
}




}





// ===============================================================================
// ===============================================================================
//      ========== Hierarchical SPAN Menu =============
// SCRIPT by Gerard Ferrandez - Ge-1-doot - APRIL 2005
// http://www.dhteumeuleu.com
// ============================================================
//window.onerror = new Function("return true");

// ===== global var ======

var Current_Date = new Date();
var Current_Year = Current_Date.getYear();
var m,menuSpan,textSpan,textPath,textDate,colBar,adtxt,W,H,indicator,backBar;
var dxm = [2,1,2,1,0,0,-1];
var dym = [2,2,1,1,2,1,-1];
var cancelBub = false;
var zB = 0;
var xB = -.5;
var yB = -.5;
var zP = 0;
var xP = 0;
var yP = 0;
var speed = 10;




// ===== reset this.spa =====
function resetSpa(o){
	if(o.spa){
		o.spa="";
		for(i in o.m)resetSpa(o.m[i]);
	}
}


// ===== insert HTML elements =====
function createHTML(o){
	o.spa                  = document.createElement("span");
	o.spa.style.position   = "absolute";
	o.spa.style.background = o.bkg;

	o.spa.style.cursor     = o.parent==""?"default":"pointer";
	o.spa.onmousedown      = new Function("return false;");




	o.spa.onselectstart    = new Function("return false");

	o.lab                  = document.createElement("span");
	if(lemonTitle==1){
		o.lab.style.color   	= lemonCol;
	}
	else{
		o.lab.style.color   	= o.fontc;
	}
	o.lab.className        = "labSpan";
	o.lab.innerHTML        = o.label;
	parentSPAN             = o.parent==""?menuSpan:o.parent.spa;
	o.spa.obj              = o;
	o.spa.onclick          = o.click;
	o.spa.appendChild(o.lab);
	parentSPAN.appendChild(o.spa);
}


function animHTML(o,x,y,w,h){
	// ==== create HTML tags
	if(!o.spa)createHTML(o);
	// ==== SPAN position & size
	
	if(w<3*W){
		// ==== span size
		o.spa.style.width  = Math.floor(w);
		o.spa.style.height = Math.floor(h);
		// ==== font size
		fs = w/12;
		if(fs>5 && fs<128){
			o.lab.style.visibility = "visible";
			o.lab.style.fontSize   = Math.round(fs)+"px";
		} else o.lab.style.visibility = "hidden";
	}
	// ==== span position
	x += o.oX;
	if(x<-W){
		for(i in o.m)o.m[i].oX=x+W;
		x=-W;
	} else for(i in o.m)o.m[i].oX=0;
	y += o.oY;
	if(y<-W){
		for(i in o.m)o.m[i].oY=y+W;
		y=-W;
	} else for(i in o.m)o.m[i].oY=0;
	o.spa.style.left = Math.round(x);
	o.spa.style.top  = Math.round(y);
}


// ==== recursive call
function animateChildren(o,w,h){
	if(w<W/28 || (-W*xB)+(o.px*W*zB)>W-2 || (-W*xB)+(o.px*W*zB)+w<W/6 || (-H*yB)+(o.py*H*zB)>H-2 || (-H*yB)+(o.py*H*zB)+h<H/6){
		// ===== remove invisible spans
		if(o.spa){
			o.parent.spa.removeChild(o.spa);
			resetSpa(o);
		}
	} else {
		// ===== anim visible objects
		animHTML(o,o.dx*w,o.dy*h,w,h);
		for(i in o.m) animateChildren(o.m[i],w/3,h/3);
	}
}

function doZoom(x,y,z){
	// ==== increment
	zB += zP;
	xB += xP;
	yB += yP;

	// ==== end zoom
	if(Math.round(z * 1000) == Math.round(zB * 1000)){
		zB = z;
		yB = y;
		xB = x;
		cancelBub = false;
	}
	// ==== loop
	else setTimeout("doZoom("+x+","+y+","+z+");",0);
	// ==== animHTML
	animHTML(m, -W*xB, -H*yB, W*3*zB, H*3*zB);
	for(i in m.m) animateChildren(m.m[i], W*zB, H*zB);
}

// ===== create menu element =====
function createMenu(label, bkg, parent, hlink, ophp, fontc, bgc, adtxt) {
	// ==== attributes
	this.dx      = parent==""?0:dxm[parent.m.length];
	this.dy      = parent==""?0:dym[parent.m.length];
	this.px      = 0;
	this.py      = 0;
	this.lev     = 0;
	this.parent  = parent;
	this.m       = new Array();
	this.label   = label;
	this.hlink   = hlink;
	this.path    = "";
	this.tdate   = "";
	this.colb    = "";
	this.backb    = "";
	this.zoomed  = false;
	this.spa     = "";
	this.lab     = "";
	this.spa.obj = "";
	this.bkg     = bkg;
	this.ophp    = ophp;
	this.fontc   = fontc;
	this.bgc     = bgc;
	this.adtxt   = "";
	this.oX      = 0;
	this.oY      = 0;


	// ===== create nodes - calculate position ====
	this.createNode = function(c,b,h,ophp, fontc, bgc, adtxt) {
		this.m[this.m.length] = newItem = new createMenu(c, b, this, h, ophp, fontc, bgc, adtxt);
		newItem.lev = this.lev + 1;
		p = newItem;
		do {
			n = Math.pow(3,p.lev-1);
			newItem.px += p.dx/n;
			newItem.py += p.dy/n;
			newItem.path = p.label.replace(/ /," ")+"."+newItem.path;
			p = p.parent;
		}
		while(p!="");
		return newItem;
	}
	// ===== node onclick event =====
	this.click = function() {
		if(!cancelBub){
			if(this.obj.zoomed && this.obj.lev>0){
				// ===== zoom out
				this.obj.zoomed = false;
				this.obj.parent.zoomed = false;
				this.obj.parent.spa.onclick();
			} else {
				// ===== zoom in
				cancelBub = true;
				this.obj.zoomed = true;
				// ===== insert right panel HTML, display path
				ajaxpage(ophp, 'contentarea',0);





				if(ophp!="intro.php"){
					document.home_gif.src=imgPath+'/home.gif';
					indicator="<img src='"+imgPath+"/indicator2.gif' width='32' height='32' style='position:relative;top:180px;left:190px;'>";
				}
				else{
					document.home_gif.src=imgPath+'/home2.gif';
					indicator="";
				}
				textSpan.innerHTML = "<div id='contentarea' style='overflow:hidden;margin:0px;width:100%;height:100%;background-color:"+ bgc+"'>"+indicator+"</div>";
				
				if(adtxt){
					colBar.style.visibility = "visible";
					colBar.innerHTML = "<div style='position:relative;top:10px;'>"+adtxt+"</div>";
				}
				else{
					colBar.style.visibility = "hidden";
				}


				if(this.obj.path==""){
					textPath.innerHTML = "&copy; copyright 2003-"+Current_Year+"&nbsp;"+company;
				}
				else{
					textPath.innerHTML = this.obj.path;
				}
				backBar.style.visibility = "hidden";
				// ===== run zoom
				z  = Math.pow(3, this.obj.lev-1);
				zP = (z-zB)/speed;
				xP = ((z*this.obj.px)-xB)/speed;
				yP = ((z*this.obj.py)-yB)/speed;
				doZoom(z*this.obj.px, z*this.obj.py, z);
				if(this.obj.hlink){
					// ==== open hyperlink window
					location.replace(this.obj.hlink);
				}
if(ophp=="portfolio.php?start=1"){
	pfn="portfolio";
	pfv=1;
	var cookie_portfolio = pfn + "=" + escape ( pfv );
	document.cookie = cookie_portfolio;
}

			}
		}
		return false;
	}
}
// ===== resize window ====









function resize(){
	//nx = document.body.offsetWidth;
	//ny = document.body.offsetHeight;
	//nx = screen.width;
	ny = screen.height;
	nx = 1024;
	//ny = 600;
	W  = Math.round(nx * .4);
	H  = Math.round(ny * .8);
	if (H > W) H = W;
	if (W > H) W = H;
	with(textSpan.style){
		width    = W;
		height   = H;
		left     = 0;
		top      = -H/2;
		fontSize = W/24+"px";
	}
	with(menuSpan.style){
		width    = W;
		height   = H;
		left     = -W;
		top      = -H/2;
	}
	with(textPath.style){
		width    = W*2;
		height   = 18;
		left     = -W;
		top      = H/2;
		fontSize = W/30+"px";
	}
	with(textDate.style){
		width    = W*2;
		height   = 18;
		left     = -W;
		top      = -H/2-23;
		fontSize = W/24+"px";
	}
	with(colBar.style){
		width    = W/2.3;
		height   = 75;
		left     = W/2;
		top      = H/2-75;
		fontSize = W/34+"px";
	}
	with(backBar.style){
		width    = 16;
		height   = 26;
		left     = W-17;
		top      = H/2-50;
	}


	animHTML(m, -W*xB, -H*yB, W*3*zB, H*3*zB);
	for(var i in m.m) animateChildren(m.m[i], W*zB, H*zB);
}
onresize = resize;



function listing(source_code,cR_){
	/* LCD Date */
	var gohome 	= "<img name='home_gif' src='"+imgPath+"/home.gif' width='20' height='21' border='0' onMouseOver=\"document.home_gif.src='"+imgPath+"/home2.gif';\" onMouseOut=\"document.home_gif.src='"+imgPath+"/home.gif';\" onclick=\"menuStart();\">";
	var mail 	= "<a href='#' onclick=\"ajaxpage('all.php?show=contact','contentarea',1);\"><img name='mail_gif' src='"+imgPath+"/mail.gif' width='20' height='21' border='0' onMouseOver=\"document.mail_gif.src='"+imgPath+"/mail2.gif';\" onMouseOut=\"document.mail_gif.src='"+imgPath+"/mail.gif';\"></a>";
	var fav 	= "<img name='fav_gif' src='"+imgPath+"/favourite.gif' width='20' height='21' border='0' onMouseOver=\"document.fav_gif.src='"+imgPath+"/favourite2.gif';\" onMouseOut=\"document.fav_gif.src='"+imgPath+"/favourite.gif';\" onclick=\"javascript:bookmarksite('mild lemon','"+mlDomain+"')\">";
	var print 	= "<img name='print_gif' src='"+imgPath+"/print.gif' width='20' height='21' border='0'  onMouseOver=\"document.print_gif.src='"+imgPath+"/print2.gif';\" onMouseOut=\"document.print_gif.src='"+imgPath+"/print.gif';\" onclick=\"javascript:window.print()\">";
	var en	 	= "<img name='en_gif' src='"+imgPath+"/en2.gif' width='20' height='21' border='0'>";
	//var th	 	= "<a href='index_t.php'><img name='th_gif' src='"+imgPath+"/th.gif' width='20' height='21' border='0'  onMouseOver=\"document.th_gif.src='"+imgPath+"/th2.gif';\" onMouseOut=\"document.th_gif.src='"+imgPath+"/th.gif';\"></a>";
	//var de	 	= "<a href='index_g.php'><img name='de_gif' src='"+imgPath+"/de.gif' width='20' height='21' border='0'  onMouseOver=\"document.de_gif.src='"+imgPath+"/de2.gif';\" onMouseOut=\"document.de_gif.src='"+imgPath+"/de.gif';\"></a>";
	var led 	= "";
	textDate.innerHTML=en+mail+gohome+fav+print+led;

	/* parent */
	with(document) SPAN = body.appendChild(createElement('span'));
	SPAN.className = "src";

	/* main loop */
	this.disp = function (){
		with(this){

			/* screen size */
			_nx = 950;
			_nx = document.body.offsetWidth;
			nx = _nx * cR_;
			//ny=900;
			ny = document.body.offsetHeight;

			/* position parent div */
			with(SPAN.style){
				top    = document.body.scrollTop;
				left   = _nx - nx;
				width  = nx;
				height = ny;

			}


		}
	}
}











// ===== yo! zyva ! =====

function menuStart(){


	colBar = document.getElementById("colb");
	backBar = document.getElementById("backb");
	textDate = document.getElementById("tdate");
	menuSpan = document.getElementById("menu");
	textSpan = document.getElementById("text");
	textPath = document.getElementById("path");

	// ===== create menu ======
	m = new createMenu("welcome","#222222","","","intro.php","#8e8e8e","#121212");



	m.createNode("web maintenance","#3e3e3e","","maintain.php?show=entry","#7e7e7e","#989989","the cost-effective solution");
	m.m[0].createNode("outsourcing","#2e2e2e","","all.php?show=outsourcing","#6e6e6e","#989989");
	m.m[0].createNode("services","#1e1e1e","","maintain.php?show=services","#5e5e5e","#989989");
	m.m[0].createNode("internet experts","#5a5a5a","","maintain.php?show=experts","#9a9a9a","#989989");
	m.m[0].m[0].createNode("remote access","#1e1e1e","","maintain.php?show=remote","#5e5e5e","#989989");
	m.m[0].m[1].createNode("service accounts","#3e3e3e","","maintain.php?show=reports","#7e7e7e","#989989");
	m.m[0].m[1].createNode("service plans","#2e2e2e","","maintain.php?show=plans","#6e6e6e","#989989");
	m.m[0].m[1].m[0].createNode("account setup","#1e1e1e","","maintain.php?show=setup","#5e5e5e","#989989");




	m.createNode("web development","#5a5a5a","","development.php?show=entry","#9a9a9a","#989989","it's all about know-how");
	m.m[1].createNode("web applications","#4a4a4a","","development.php?show=applications","#8a8a8a","#989989");
	m.m[1].createNode("web design","#2a2a2a","","development.php?show=webdesign","#6a6a6a","#989989");
	m.m[1].m[0].createNode("databases","#1a1a1a","","development.php?show=databases","#5a5a5a","#989989");
	m.m[1].m[0].createNode("approach","#2a2a2a","","development.php?show=approach1","#6a6a6a","#989989");
	m.m[1].m[0].createNode("programming","#3a3a3a","","development.php?show=prog1","#7a7a7a","#989989");
	m.m[1].m[1].createNode("strategy","#3a3a3a","","development.php?show=strategy","#7a7a7a","#989989");
	m.m[1].m[1].createNode("approach","#1a1a1a","","development.php?show=approach2","#5a5a5a","#989989");
	m.m[1].m[1].createNode("programming","#5a5a5a","","development.php?show=prog2","#9a9a9a","#989989");
	m.m[1].m[0].m[0].createNode("database systems","#2a2a2a","","development.php?show=dbsys","#6a6a6a","#989989");
	m.m[1].m[0].m[1].createNode("costs","#4a4a4a","","development.php?show=costs1","#7a7a7a","#989989");
	m.m[1].m[0].m[1].createNode("ownership","#3a3a3a","","all.php?show=owner","#7a7a7a","#989989");
	m.m[1].m[0].m[1].createNode("contact us","#5a5a5a","","all.php?show=contact","#9a9a9a","#989989");
	m.m[1].m[1].m[1].createNode("costs","#2a2a2a","","development.php?show=costs2","#6a6a6a","#989989");
	m.m[1].m[1].m[1].createNode("ownership","#3a3a3a","","all.php?show=owner","#7a7a7a","#989989");
	m.m[1].m[1].m[1].createNode("contact us","#4a4a4a","","all.php?show=contact","#8a8a8a","#989989");
	m.m[1].m[1].m[2].createNode("multilingual","#4a4a4a","","all.php?show=multilingual","#7a7a7a","#989989");



	m.createNode("graphic design","#4e4e4e","","design.php?show=entry","#8e8e8e","#989989","first impressions do matter");
	m.m[2].createNode("artwork","#3e3e3e","","design.php?show=artwork","#7e7e7e","#989989");
	m.m[2].createNode("values","#5e5e5e","","design.php?show=values","#9e9e9e","#989989");



















	list = new listing(document.documentElement.innerHTML,.5);
	setInterval("list.disp();", 32);




	// =====
	resize();
	m.spa.onclick();
}
// ===============================================================================
// ===============================================================================
function popup(URL,hor,vert,id,scroll){
if(scroll!=1){
	scroll=0;
}
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars= " + scroll + ",location=0,statusbar=0,menubar=0,resizable=0,width= " + hor + ",height= " + vert + "');");
}



