function removeElement(div) {
    var d = document.getElementById('content');
    var olddiv = document.getElementById(div);
    d.removeChild(olddiv);
}

function removejscssfile(filename, filetype){
 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
 var allsuspects=document.getElementsByTagName(targetelement)
 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
  if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
   allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
 }
}

function getElementHeight(elname) {
    var divHeight;
    var obj = document.getElementById(elname);

    if (obj.style.visibility=='hidden') return false; // printing

    if(obj.offsetHeight)          {
        divHeight=obj.offsetHeight;
    }
    else if(obj.style.pixelHeight){
        divHeight=obj.style.pixelHeight;
    }
    return divHeight;
}

function setHeightBg() {
    if (detectGoodBrowser()) {
        // content height is the same as the height of a background picture
        var imgHeight = getElementHeight('background_image');
        $("#content").css("height",(imgHeight-30)+'px');
    }
    else {
      // IE6
      if ($("#content").height() < $("#background_image").height()) {
        $("#background_image").width("100%");
        $("#background_image").height("100%");
      }
    }
}

function detectGoodBrowser()
{
//var browser=navigator.appName;
//var b_version=navigator.appVersion;
//var version=parseFloat(b_version);
//if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")
//  && (version>=5))
// {
//  return true;
// }
//else
//  {
//  return false;
//  }

// IE6 or older
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
return !IE6;
}

// main jquery section, all effects
$(document).ready(function(){

    if (detectGoodBrowser()) {  
      advancedEffects();
    }
    

    // top menu rolls submenu on hover
    $(".topmenu").hover(
        function () {
            $("#sub"+this.id).slideDown("fast");
        },
        function () {
            $("#sub"+this.id).slideUp("fast");
        }
        );

    // topmenu click slides up the content wrapper
    $(".topmenu").click(
        function () {
        //$("#content_wrapper").slideUp("slow");
        }
        );

    function showMessages() {
        $('#error').fadeIn('slow');
        $('#message').fadeIn('slow');
    }

    function hideMessages() {
        $('#error').fadeOut('slow');
        $('#message').fadeOut('slow');
    }

    // messages errors fades in and out after some time
    showMessages();
    $.timeout(hideMessages, 3000);

    function advancedEffects() {

        // content wrapper scrolls down
        // $("#content_wrapper").slideDown("slow");

        function transpEffects() {
            $(".transparent").css("left","1500px");
            $(".transparent").animate({
                left:"-=1500px"
            },1000);
        }
        //if (isSection) transpEffects();

        // photo thumbnails are doing a caroussel effect
    $(".existing_photo").hover(
        function () {
            $(this).animate({
                paddingLeft:"5px",
                paddingRight:"5px"
            },200);
        },
        function () {
            $(this).animate({
                paddingLeft:"0px",
                paddingRight:"0px"
            },200);
        }
        );
    }
});

