
//  HEY PEOPLE!  Update your browsers, help me help you.
//  see where you stand PLEASE:  --->   http://www.acidtests.org/

var hd=1, rot=1, a=1,o=.1;
var xmlhttp = false;
var xmlhttp2 = false;
var g2g = false;
var blnk = false;
var pg, rnd1;
var _d = document;

function strt(){

	o=o+.03;
	a++;a++;a++;
	if(!notIE){zeeh.filters.alpha.opacity=a;}else{zeeh.style.opacity=o;}	
	
	if(a<101) setTimeout('strt();', 1);
	else{
		a=1;o=.1;
		setTimeout('strt2();', 1);
	}
}
function strt2(){

	if(lnk==rot){ 
		tl="d"+lnk; 
		_d.getElementById(tl).className = "hdr1"; 
	}

	hd = hd + 10;
	if(rot==7&&hd<140){
		_d.getElementById('d'+rot).style.width = hd;
		_d.getElementById('d8').style.width = '15px';
	}
	else if(hd<190&&rot!='8') _d.getElementById('d'+rot).style.width = hd+'px';
	else if(hd>190&&rot!='8') _d.getElementById('d'+rot).style.width = '190px';

	if(rot<7&&hd>109){
		hd = 1;
		switch(rot){
			case 1: ttl='About Me'; rot++; break;
			case 2: ttl='Resumé'; rot++; break;
			case 3: ttl='Global Exp.'; rot++; break;
			case 4: ttl='Designing'; rot++; break;
			case 5: ttl='Programming'; rot++; break;
			case 6: ttl='Contact Me'; rot++; break;
			default: ttl=''; break;
		}
		trot = rot -1;
		_d.getElementById('d'+trot).innerHTML = ttl;
	}
	else if(hd>249){
		hd = 1;
		rot++;
	}
	else if(rot==8&&hd>9) rot++;

	if(rot<9) setTimeout('strt2();', 1);
	else
		if(mystf.innerHTML==""){
			blnk=true;
			ajax_read("about.php?ajx=a");
			return false;
		}
		else setTimeout('fde();', 1);
}

function fde(){
	o=o+.05;
	a++;a++;a++;
	if(!notIE){zee2.filters.alpha.opacity=a;}else{zee2.style.opacity=o;}
	
	//if(a<30)if(!notIE){_d.getElementById("ubuntuTemp").style.filters.alpha.opacity=a;}else{_d.getElementById("ubuntuTemp").style.opacity=o;}
	
	if(a<101) setTimeout('fde();', 1); 
	g2g=true;
}

function ajax_read(url) {

	_d.getElementById("mystf").innerHTML = "<tt>Loading...</tt>";
	dvcnt.scrollTop=0; // Scroll to the top

	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');
		}
	} else if(window.ActiveXObject){
		try{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){}
		}
	}

	if(!xmlhttp) {// ajax not functional
		mystf.innerHTML = 'I\'m sorry but AJAX unable to load at this time.';
		return false;
	}

	xmlhttp.open("POST",url,true);
	
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState==4 && xmlhttp.status == 200) {
			cntnt = xmlhttp.responseText; //Get the actual file: if XML ; responseXML
			_d.getElementById("mystf").innerHTML = cntnt;
			var objDiv = _d.getElementById("mystf");
			objDiv.scrollTop = objDiv.scrollHeight;
		}
	}
	g2g=true;
	xmlhttp.send(null);
}

// Send E-mail
function emlng(){

	var contact = _d.getElementById('contact').value;
	var mail = _d.getElementById('mail').value;
	var phne = "("+_d.getElementById('pha').value+") "+_d.getElementById('ph1').value+"-"+_d.getElementById('ph2').value;
	var typ = _d.getElementById('typ').value;
	var comments = _d.getElementById('comments').value;

	// Guess what i'm doing here... hummm...
	contact = contact.replace(/&/g, "30sk3re78wk0di4jw9");
	mail = mail.replace(/&/g, "30sk3re78wk0di4jw9");
	comments = comments.replace(/&/g, "30sk3re78wk0di4jw9");
	
	var prams = 'contact='+contact+'&mail='+mail+'&phne='+phne+'&typ='+typ+'&comments='+comments;

	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');
		}
	} else if(window.ActiveXObject){
		try{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){}
		}
	}

	if(!xmlhttp) {
		alert('Dag nabbit, giving up... \n\nCannot create an XMLHTTP instance.');
		return false;
	}

	if(xmlhttp){
		xmlhttp.open('POST','email.php?ajx=a',true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", prams.length);
		xmlhttp.send(prams);
	}	
	_d.getElementById("mystf").innerHTML = '<center><br><bR><br><br>Thank you.<BR><BR> Your message has been sent.';
}

////////////// Menu

// Over
function mvr(z,x){ if(z!=lnk&&g2g)x.className = "hdr3";	}

// Off
function mf(z,x){ if(z!=lnk&&g2g)x.className = "hdr2";	}

// Click
function mclk(z,x,pg){
	t = "d"+z;
	if(z!=lnk&&g2g){
		tl = "d"+lnk;
		_d.getElementById(tl).className = "hdr2";
		_d.body.style.cursor = "default";
		_d.getElementById(t).className = "hdr1";

		lnk = z;
		g2g=false;
		
		if(z==4&&notIE) _d.getElementById('dvcnt').className = "area_n";
		else _d.getElementById('dvcnt').className = "area_e";
		
		if(z==6&&notIE){
			//window.open('contact_2.php','ffsuxWindow','width=400,height=520');
			_d.getElementById("mystf").innerHTML = '<iframe name="FRAME1" src="./contact_3.php" frameborder="0" style="border:0px; margin-left:200px; margin-top:5px; width:400px; height:400px;" scrolling="no"></iframe>';
			g2g=true;
		}else{
			url = pg + ".php?ajx=a";
			ajax_read(url);
		}
	}
}
function opnw(x,w,h,z,c){
	x.className='flt';
	picWindow = window.open("", "", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,menubar=0,width="+w+",height="+h);
	picWindow.document.open();
	picWindow.document.write('<html><head><title>SethDailey.org - Image</title></head><body topmargin="0" leftmargin="0" zbgcolor="#'+c+'">');
	picWindow.document.write('<table border=0 cellspacing=0 cellpadding=0><tr><td onclick="window.close();"><img src="./portfolio/'+z+'.png" syle="cursor:pointer;">');
	picWindow.document.write('</td></table></body></html>');
	picWindow.document.close();
}

function alertSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Not MS
    elwdth = window.innerWidth;
    elhgt = window.innerHeight;
  } else if( _d.documentElement && ( _d.documentElement.clientWidth || _d.documentElement.clientHeight ) ) {
    //Microsoft
    elwdth = _d.documentElement.clientWidth;
    elhgt = _d.documentElement.clientHeight;
  } 
}

// Its me!... Hello ladies...
function prf(){
	_d.getElementById('itmep').style.display="inline";
	_d.getElementById('itmeg').style.display="none";
	
	_d.getElementById('prf1').className="itmeon";
	_d.getElementById('grd1').className="itmeoff";

}
function grd(){
	_d.getElementById('itmep').style.display="none";
	_d.getElementById('itmeg').style.display="inline";
	
	_d.getElementById('prf1').className="itmeoff";
	_d.getElementById('grd1').className="itmeon";
}

