var consultation_arrow = new Image();
var design_arrow = new Image();
var development_arrow = new Image();

function English()
{
	document.location.href='/eng';
}

var innerHeight, innerWidth;

function calculateInnerSize() {
    if (self.innerHeight) // other Explorers
    {
        innerWidth = self.innerWidth;
        innerHeight = self.innerHeight;
    }
    else if (document.body) // all except Explorer
    {
        innerWidth = document.body.clientWidth;
        innerHeight = document.body.clientHeight;


    }
    else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
    {
        innerWidth = document.documentElement.clientWidth;
        innerHeight = document.documentElement.clientHeight;
    }
}


function preloadImages()
{
	
	development_arrow.src = '/Design/HomePage/ArrowDevelopment2_heb.png';			
	design_arrow.src = '/Design/HomePage/ArrowDesign2_heb.png';
	consultation_arrow.src = '/Design/HomePage/ArrowBranding_heb.png';
}

function showAllButtons()
{
	document.getElementById("div_design").style.marginRight = '6px';	
	document.getElementById("div_development").style.marginRight = '6px';
	document.getElementById("div_consultation").style.width = '196px';
	document.getElementById("div_design").style.width = '196px';

	document.getElementById("btn_consultation").style.display = '';
	document.getElementById("btn_design").style.display = '';
	document.getElementById("btn_development").style.display = '';	
	
}

function hideAllExplainations()
{
	document.getElementById("div_consultation_content").style.display = 'none';
	document.getElementById("div_design_content").style.display = 'none';
	document.getElementById("div_development_content").style.display = 'none';
}

function consultation()
{
	showAllButtons();
	hideAllExplainations();
	document.getElementById("btn_consultation").style.display = 'none';	
	document.getElementById("div_consultation").style.width = '0px';	
	document.getElementById("div_design").style.marginRight = '202px';	
	document.getElementById("TheProcess").className = 'Consultation_Selected';
	document.getElementById("TheProcess").style.backgroundImage  = 'url('+consultation_arrow.src+')';
	document.getElementById("div_consultation_content").style.display = 'block';

	resizeSidebarHeight();
}

function design()
{
	showAllButtons();
	hideAllExplainations();
	document.getElementById("btn_design").style.display = 'none';
	document.getElementById("div_design").style.width = '0px';
	document.getElementById("div_development").style.marginRight = '208px';
	document.getElementById("TheProcess").className = 'Design_Selected';
	document.getElementById("TheProcess").style.backgroundImage  = 'url('+design_arrow.src+')';
	document.getElementById("div_design_content").style.display = 'block';

	resizeSidebarHeight();
}

function development()
{
	showAllButtons();
	hideAllExplainations();
	document.getElementById("btn_development").style.display = 'none';
	document.getElementById("TheProcess").className = 'Development_Selected';
	document.getElementById("TheProcess").style.backgroundImage  = 'url('+development_arrow.src+')';
	document.getElementById("div_development_content").style.display = 'block';

	resizeSidebarHeight();
}

function explainations_onmouseout()
{
	document.getElementById("TheProcess").style.backgroundImage  = '';
	showAllButtons();
	hideAllExplainations();

	resizeSidebarHeight();
}

function loadHeader()
{
	var flashvars = {};
	var params = { allowscriptaccess: "always", allowfullscreen: "false", autostart: "true", wmode: "transparent" }; 
	var attributes = {  id: "header",  name: "header"};

	swfobject.embedSWF("Flash/Main2_Heb.swf", "header_flash", "645", "190", "9.0.0","",flashvars,params,attributes);
}

function RecentWorks()
{
	var flashvars = {Lang: "heb"}; 
	var params = {  allowscriptaccess : "always", allowfullscreen : "false", autostart : "true", wmode : "transparent"}; 
	var attributes = {  id: "recentWorks",  name: "recentWorks"};

	swfobject.embedSWF("RecentWorks.swf", "RecentWorks_Container", "600", "220", "9.0.0","",flashvars,params,attributes);
}

// display the TopLayer flash file for "Sites" gallery category at 0 size (so it won't be on-top of sidebar menu links in firefox)
function writeFlash_Sites_Large(_previewType, _lang) {
    var flashvars = { PreviewType: _previewType, Lang: _lang };
    var params = { allowscriptaccess: "always", allowfullscreen: "false", autostart: "true", wmode: "transparent" };
    var attributes = { id: "itemLarge", name: "itemLarge" };

    swfobject.embedSWF("/Flash/TopLayerGallery2.swf", "itemLarge_Flash", "1", "1", "9.0.0", "", flashvars, params, attributes);
    //document.getElementById("itemLarge_Container").style.width = innerWidth-1;
    //document.getElementById("itemLarge_Container").style.height = innerHeight-1;


}


// called from gallery flash files when zooming an image (before data is sent to the TopLayer flash files)
function ShowTopLayer() {

    // resize flash div container to 100%
	
    document.getElementById("itemLarge_Container").style.width = '100%';
    document.getElementById("itemLarge_Container").style.height = innerHeight + 'px';

    // resize flash module to 100%
    document.getElementById("itemLarge").width = '100%';
    document.getElementById("itemLarge").height = '100%';

}


// called from gallery flash files when closing a zoomed image
function CloseTopLayer() {

    // resize flash div container to 0
    document.getElementById("itemLarge_Container").style.width = '1px';
    document.getElementById("itemLarge_Container").style.height = '1px';

    // resize flash module to 0
    document.getElementById("itemLarge").width = '1px';
    document.getElementById("itemLarge").height = '1px';
}


function ResizeTopLayer(width, height) {

    if (width > innerWidth - 1) {
        //document.getElementById("itemLarge").width = '100%';
        document.getElementById("itemLarge_Container").style.width = width + 'px';
    }

    if (height - 1 > innerHeight) {
        document.getElementById("itemLarge").height = height + 'px';
        document.getElementById("itemLarge_Container").style.height = height + 'px';
    }
    else {
        document.getElementById("itemLarge").height = '100%';
        document.getElementById("itemLarge_Container").style.height = innerHeight + 'px';
    }


}

function closeLocalConnection()
{
	document.getElementById("itemLarge").closeLocalConnection();
}


		function repositionAdsense()
		{
			var myWidth = 0, myHeight = 0;

			  if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth;
				myHeight = document.documentElement.clientHeight;
			  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			  }

		   
		   NewAdsenseXpos = (myWidth / 2) - (780/2) - 110;
		   document.getElementById ("adsense").style.left = NewAdsenseXpos + 'px';
		   document.getElementById ("adsense").style.display = '';

		}
