﻿var curGroup = "";
var curMenu = "";
var isIE6 = 0;
var arVersion1 = navigator.appVersion.split("MSIE");
var version1 = parseFloat(arVersion1[1]);
    if ((version1 >= 5.5) && (version1 < 7)) 
        isIE6 = 1;
        
function flipU(id)
{
    document.getElementById("bbtn_" + id + "_bg").style.display = "block";
    //Effect.Appear("bbtn_" + id + "_bg", { duration: 0.5 });
}
function flipD(id)
{
    document.getElementById("bbtn_" + id + "_bg").style.display = "none";
    //Effect.Fade("bbtn_" + id + "_bg", { duration: 0.5 });
}
function menuPushOut(id)
{
    document.getElementById(id).style.color = '#00bce2';
}
function menuPushIn(id)
{
    return;
    var obj = document.getElementById(id);
    new Effect.Move($(id),{x: -10, y: 0, mode: 'relative',
        transition: Effect.Transitions.spring});
    curMenu = "";
}
        
function showM(group)
{
    curGroup = group;
    document.getElementById(group + 'BG').style.display = "block";
    //Effect.BlindRight(group + 'BG');
    //Effect.Appear(group + 'BG', { duration: 0.5 });
}
function hideM(group)
{
    curGroup = "";
    document.getElementById(group + 'BG').style.display = "none";
    //Effect.BlindRightBack(group + 'BG');
    //Effect.Fade(group + 'BG', { duration: 0.5 });
}

function socialROver(name){
	
	document.getElementById(name).src="../../../../graphics/icons/icon_" + name + "_active.gif";
	
}

function socialROut(name){
	
	document.getElementById(name).src="../../../../graphics/icons/icon_"	+ name + ".gif";
	
}

/*function socialROver(name){
	
	document.getElementById(name).src="siteGraphics/icons/icon_" + name + "_active.gif";
	
}

function socialROut(name){
	
	document.getElementById(name).src="siteGraphics/icons/icon_"	+ name + ".gif";
	
}*/



function getWidth()
{
    if (curGroup == "done")
        return 164;
    else if (curGroup == "talk")
        return 89;
    else    
        return 117;   
}

var curID = 1;
function changeVid(VidID,autoStart)
{
    var obj = document.getElementById("hpvideo");
    var autostart = "true";
    if (autoStart == 0)
        autostart = "false";
    var html1 = '<object id="hpvideoflash" type="application/x-shockwave-flash" width="940" height="380" data="';
    var html2 = '"><param id=hpvideoflashparam" name="movie" value="';
    var html3 = '" /><param name="wmode" value="transparent" /></object>';
    var vidURL = "";
    if (VidID == 1)
        vidURL = "siteIncludes/37-flvplayer.swf?video=/hughes3/siteGraphics/videos/curtainLoop.flv";
    else if (VidID == 2)
        vidURL = "siteIncludes/37-flvplayer.swf?video=/hughes3/siteGraphics/videos/187237504.flv";
    else if (VidID == 3)
        vidURL = "siteIncludes/37-flvplayer.swf?video=/hughes3/siteGraphics/videos/waterLoop.flv";
    else if (VidID == 4)
        vidURL = "siteIncludes/37-flvplayer.swf?video=/hughes3/siteGraphics/videos/curtainLoop.flv";
    obj.innerHTML = html1 + vidURL + html2 + vidURL + html3; 
    
    for (j=1;j<5;j++)
        document.getElementById("hpvidbox" + j).src = "siteGraphics/design/box.gif";
    
    document.getElementById("hpvidbox" + VidID).src = "siteGraphics/design/box_over.png";
    curID = VidID;   
    return false;
}

Effect.BlindRight = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({
    scaleContent: false,
    scaleY: false,
    scaleFrom: 0,
    scaleMode: {originalHeight: 24, originalWidth: getWidth()},
    restoreAfterFinish: false,
    afterSetup: function(effect) {
      effect.element.makeClipping().setStyle({
        width: '0px',
        height: effect.dims[0] + 'px'
      }).show();
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping();
    }
  }, arguments[1] || { }));
};

Effect.BlindRightBack = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 0, Object.extend({
    scaleContent: false,
    scaleY: false,
    scaleFrom: 100,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: false,
    afterSetup: function(effect) {
    },
    afterFinishInternal: function(effect) {
    }
  }, arguments[1] || { }));
};

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
function getDocWidth() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
        Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
        Math.max(D.body.clientWidth, D.documentElement.clientWidth)
    );
}
function rePos()
{
    var curHeight = getDocHeight()
    var curWidth = getDocWidth()
    if (curWidth % 6 != 0) {
        var offset = curWidth % 6;
        //document.getElementById("txtPos").value = "off " + (curWidth / 6) + " / " + (offset);
        if (offset == 5)
            offset = 6;
        if (offset == 4)
            offset = 6;
        if (document.getElementById("hplowboxes"))
            document.getElementById("hplowboxes").style.marginTop = (31 + offset) + "px";
        offset = curWidth % 6;
        if (offset == 2)
            offset = 1;
        if (offset == 3)
            offset = 2;
        if (document.getElementById("videowrapper")) {
            document.getElementById("videowrapper").style.marginTop = offset + "px";
            document.getElementById("videowrapper").style.marginBottom = "-" + offset + "px";
        }
    }
    else {
        //document.getElementById("txtPos").value = curWidth + "/" + (curWidth / 6);
        if (document.getElementById("hplowboxes"))
        document.getElementById("hplowboxes").style.marginTop = "31px";
        if (document.getElementById("videowrapper"))
            document.getElementById("videowrapper").style.marginTop = "0px";
    }
    obj = document.getElementById("flashbox");
    obj.style.height = curHeight + 20 + "px";
    obj = document.getElementById("gridbox");
    obj.style.height = curHeight + 20 + "px";
}

function startItems()
{
    rePos();
    try
    {
        //I had to do this manually, or it wouldn't load in Safari at all;
        initLightbox();
    }
    catch(err)
    {
    //hide errors when loading lightbox
        //alert(err);
    }
	
	if (document.images)
	{
  		pic1= new Image(20,20); 
  		pic1.src="siteGraphics/icons/icon_twitter_active.gif"; 
		
		pic2= new Image(20,20); 
  		pic2.src="siteGraphics/icons/icon_behance_active.gif"; 
		
		pic3= new Image(20,20); 
  		pic3.src="siteGraphics/icons/icon_facebook_active.gif"; 
		
		pic4= new Image(20,20); 
  		pic4.src="siteGraphics/icons/icon_flickr_active.gif"; 
		
		pic5= new Image(20,20); 
  		pic5.src="siteGraphics/icons/icon_lastfm_active.gif"; 
		
		pic6= new Image(20,20); 
  		pic6.src="siteGraphics/icons/icon_linkedin_active.gif"; 
		
		pic7= new Image(20,20); 
  		pic7.src="siteGraphics/icons/icon_vimeo_active.gif"; 
	}
	
}

window.onresize = rePos;