/*
	file name: orci.js
	  version: 2010-02-22
	   author: Pixelmodule Inc.,
	  website: http://pixelmodule.com
	    email: contact@pixelmodule.com
	
	Orci.com Javascript
    Copyright ©2010 PIXELMODULE Inc., All Right Reseverd.

*/

var _location = "home";
var _flashplayer_id = "flashplayer";

if (swfobject.hasFlashPlayerVersion("6.0.0")) {
  	var fn = function() {
		var varis = { };
		var params = { wmode:"transparent" };
		swfobject.embedSWF("cgi/socialnetwork.swf", _flashplayer_id, "100%", "100%", "10.0.0", "cgi/expressInstall.swf", varis, params); 
  	};
  swfobject.addDomLoadEvent(fn);
}

function flashDo(command, args) {
		var obj = swfobject.getObjectById(_flashplayer_id);
		
		if (command == "plotCourse") { obj.plotCourse(args) }
}

function isObject(targetID){
   var isFound = false;
   var el = document.getElementById(targetID);
   if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
      isFound = true;
   }
   return isFound;
}

function replaceSwfWithEmptyDiv(targetID){
   var el = document.getElementById(targetID);
   if(el){
      var div = document.createElement("div");
      el.parentNode.insertBefore(div, el);

      swfobject.removeSWF(targetID);

      div.setAttribute("id", targetID);
   }
}
 

function navigateTo(location)
{
	_location = location;
	
	if(isObject(_flashplayer_id)) { replaceSwfWithEmptyDiv(_flashplayer_id)}
	
	var swf = "cgi/socialnetwork.swf";
	
	if ( location == "home" ) 		{ swf = "cgi/socialnetwork.swf" }
	if ( location == "about" ) 		{ swf = "cgi/about.swf" }
	if ( location == "portfolio") 	{ swf = "cgi/portfolio.swf" }
	if ( location == "clients" ) 	{ swf = "cgi/clients.swf" }
	if ( location == "people" ) 	{ swf = "cgi/people.swf" }
	if ( location == "contact" )	{ swf = "cgi/contact.swf" }
	

	var varis = { };
	var params = { wmode:"transparent" };
	swfobject.embedSWF(swf, _flashplayer_id, "100%", "100%", "10.0.0", "cgi/expressInstall.swf", varis, params);
}


function gradient(condition)
{
	if ( condition == "visible") { document.getElementById('backgroundgradient').style.visibility = 'visible' } 
	if ( condition == "hidden" ) { document.getElementById('backgroundgradient').style.visibility = 'hidden' }
}

function addHandlers() {
	var a = document.getElementById("home");
	if (a) {
		a.onclick = function() {
			flashDo("plotCourse", "home"); 
			return false;
		};
	}
	var b = document.getElementById("portfolio");
	if (b) {
		b.onclick = function() {
			flashDo("plotCourse", "portfolio"); ;
			return false;
		};
	}
	var c = document.getElementById("contact");
	if (c) {
		c.onclick = function() {
			flashDo("plotCourse", "contact"); ;
			return false;
		};
	}
}
swfobject.addLoadEvent(addHandlers);
