// JavaScript Document
// Copyright 2010
// Kiosk Group, Inc.

//menu
function createMenu(){
	document.write('<div id="links">');
	document.write('<ul>');
	document.write('<li><a href="index.html">Home</a></li>');
	document.write('<li><a href="portfolio.html">Portfolio</a>');
	document.write('<li><a href="clientele.html">Clientele</a></li>');
	document.write('<li><a href="about.html">About</a></li>');
	document.write('<li><a href="contact.php">Contact</a></li>');
	document.write('</ul>');
	document.write('</div>');
}
function displayMessage(n){
	var e=document.getElementById('displaybox');
	if(e.style.display == "none") {
		e.style.display = "";
		document.body.scroll="no";
		document.body.style.overflow="hidden";
		e.style.position = "fixed";
		document.getElementById('disimg').style.position = "fixed";
		e.style.height='100%';
		document.getElementById('disimg').style.display = "";
		document.getElementById('disimg').innerHTML = '<div id="distxt" align="center" style="width:500px; color:#000; background-color:#FFF; text-align:left; padding:10px; vertical-align:middle;">'+n+'<p align="center" style="padding:0px; margin:0px;"><br><input type="button" value="Close" onclick="closeWindow();" class="submit_button"></p></div>';
		document.getElementById('disimg').style.left=Math.abs((Client.viewportSize().width-document.getElementById('distxt').clientWidth)/2)+'px';
		document.getElementById('disimg').style.top=Math.abs((Client.viewportSize().height-document.getElementById('distxt').clientHeight)/2)+'px';
	} else {
		closeWindow();
	}
}
var http_request = false;
function makeRequest(url, parameters, changeevent) {
	http_request = false;
	if (window.XMLHttpRequest) {
		//Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			//set type accordingly to anticipated content type
			//http_request.overrideMimeType('text/xml');
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) {
		//IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	http_request.onreadystatechange = changeevent;
	http_request.open('GET', url + parameters, true);
	http_request.send(null);
}
function showContents() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			//alert(http_request.responseText);
			result = http_request.responseText;
			document.getElementById('display_news').innerHTML = result;
		} else {
			document.getElementById('display_news').innerHTML = 'There was a problem with the request.';
		}
	}
}
function doArticle() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			//alert(http_request.responseText);
			result = http_request.responseText;
			//alert(result);
			var e=document.getElementById('displaybox');
			if(e.style.display == "none") {
				e.style.display = "";
				document.body.scroll="no";
				document.body.style.overflow="hidden";
				e.style.position = "fixed";
				document.getElementById('disimg').style.position = "fixed";
				e.style.height='100%';
				document.getElementById('disimg').style.display = "";
				document.getElementById('disimg').innerHTML = '<div id="distxt" align="center" style="-moz-border-radius: 5px; -webkit-border-radius: 5px; width:500px; color:#000; background-color:#FFF; text-align:left; padding:10px; vertical-align:middle;">'+result+'<p align="center" style="padding:0px; margin:0px;"><br><input type="button" value="Close" onclick="closeWindow();" class="submit_button"></p></div>';
				document.getElementById('disimg').style.left=Math.abs((Client.viewportSize().width-document.getElementById('distxt').clientWidth)/2)+'px';
				document.getElementById('disimg').style.top=Math.abs((Client.viewportSize().height-document.getElementById('distxt').clientHeight)/2)+'px';
			} else {
				closeWindow();
			}
		} else {
			alert('There was a problem with the request. Please refresh the page and try again.');
		}
	}
}
function show(e){
	document.getElementById(e).style.display="";
}
function hide(e){
	document.getElementById(e).style.display="none";
}
function initImager(){
	document.write('<style>#displaybox{z-index: 10000; filter: alpha(opacity=75); filter:progid:DXImageTransform.Microsoft.Alpha(opacity=75); -moz-opacity: .75; -khtml-opacity: 0.75; opacity: 0.75; background-color:#000000; position:fixed; top:0px; left:0px; width:100%; height:100%; color:#FFFFFF; text-align:center; vertical-align:middle;} #disimg{color:#FFFFFF; z-index: 10001; position:fixed; top:0px; width:100%; height:100%; text-align:center; vertical-align:middle;}</style>');
	document.write("<div id='disimg' style='display:none;'></div><div id='displaybox' style='display:none;'></div>");
}
var Client = {
	viewportWidth: function() {
		return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
	},
	viewportHeight: function() {
		return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);
	},
	viewportSize: function() {
		return { width: this.viewportWidth(), height: this.viewportHeight() };
	}
};
function closeWindow(){
	document.body.scroll="auto";
	document.body.style.overflow="auto";
	var e=document.getElementById('displaybox');
	e.style.display = "none";
	document.getElementById('disimg').style.display = "none";
	document.getElementById('disimg').innerHTML = '';
}
