// JavaScript Document
// show hide divs
function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }
// end show/hide divs


function show_visibility(IDS){
hide_visibility();
document.getElementById(IDS).style.display = 'block';
}

function hide_visibility(){
var sel = document.getElementById('clients').getElementsByTagName('div');
	for (var i=0; i<sel.length; i++) { sel[i].style.display = 'none'; }
}

// status bar default messaage
defaultStatus = "Copyright &copy; 2010 The Pixel Home - All Rights Reserved."
// end default status

// write year
function copyrightYear() {
	var d = new Date();
	document.write("Copyright &copy; " + d.getFullYear());
}
// end copyright year

//contact form validation
function validate() {
	if (document.contactForm.name.value == '') {
	alert ("Please enter your Name  !!!");
	return(false);
	}

	if (document.contactForm.email.value == '') {
	alert ("Please enter your eMail  !!!");
	return(false);
	}

	if (document.contactForm.subject.value == '') {
	alert ("Please enter a Subject line  !!!");
	return(false);
	}

	if (document.contactForm.comments.value == '') {
	alert ("Please enter a Comment !!!");
	return(false);
	}
	return(true);
}
// end validation

// expand collapse 'past projects'
	function showHideContent(title,icon) {
		var titles = new Array("brochures","corporate","financial","e-commerce","education","multimedia","non-profit organizations");
		var icons = new Array("brochuresIcon","corporateIcon","financialIcon","e-commerceIcon","educationIcon","multimediaIcon","non-profit organizationsIcon");
			for (i=0; i<=titles.length; i++) {
				var laCookie = readCookie("projectCategory");
			//	if (laCookie != null) { alert (laCookie); }
				if (titles[i] !== title){
					document.getElementById(titles[i]).style.display = 'none';
					document.getElementById(icons[i]).src ='images/plusIcon.gif';
				} else {
					document.getElementById(title).style.display = '';
					document.getElementById(icon).src ='images/minusIcon.gif';
					}
			}
	}
// end collapse 'past projects'

// cookies
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours){
  var expire = "";
  if(hours != null) {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

// Example:
// alert( readCookie("myCookie") );
function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0) { 
    offset = document.cookie.indexOf(search);
    if (offset != -1) { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);

      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
// end cookies

// set language
function setLanguage(){
	var theCookie = readCookie("tphLanguage");
	if (theCookie == 'spa') {
		  HideDIV('mainContent_en');
		  DisplayDIV('mainContent_sp');
	 }
}

/*function goToPortfolio(record,industry){
	location.href = portfolio.php?record;
	
}*/
