/** menu **/

function menu_show(obj)
{
	var arr_subul = obj.parentNode.parentNode.getElementsByTagName('UL');
	var arr_selul = obj.parentNode.getElementsByTagName('UL');
	var selul = (arr_selul.length)?arr_selul[0]:null;
	for(i=0; i<arr_subul.length; i++)
		arr_subul[i].style.display=(arr_subul[i]==selul)?'block':'none';
}

/** maincontent **/

/* list-image */

function listinfo(id)
{
	
	var arr_info = $('list-image').getElementsByClassName('info');
  var info = $(id);
	for(i=0; i<arr_info.length; i++)
		arr_info[i].style.display=(arr_info[i]==info)?'block':'none';
}

function showimage(id)
{
	
	var arr_info = $('list-single').getElementsByClassName('large');
  var info = $(id);
	for(i=0; i<arr_info.length; i++)
		arr_info[i].style.display=(arr_info[i]==info)?'block':'none';
}

function showimagehuge(id)
{
	// move largeinfo element
	var t = $('largeinfo').cloneNode(true);
	$('list-single').removeChild($('largeinfo'));
	document.body.appendChild(t);
	
	// fix height on background
	var backg = $('backgroundWhite');
	
	$('largeinfo').style.display = 'block';
	backg.style.height = '100%';
	backg.style.display = 'block';
	
	$('largeimage').src = "/design/admin/images/1x1.gif";
	$('largeimage').src = "/" + id;
	
	$('body').addClassName('printLargeInfo');

// fix height
  if(backg.getHeight() < 667)
  	backg.style.height = '667px';
  else
  	backg.style.height = '100%';
}

function hideimagehuge()
{
	// move largeinfo back
	if($('largeinfo').parentNode==document.body)
	{
	var t = $('largeinfo').cloneNode(true);
	document.body.removeChild($('largeinfo'));
	$('list-single').appendChild(t);
  }

	// move largeinfo back
	if($('polar').parentNode==document.body)
	{
	var t = $('polar').cloneNode(true);
	document.body.removeChild($('polar'));
	$('list-single').appendChild(t);
  }
  
	$('backgroundWhite').style.display = 'none';
	$('largeinfo').style.display = 'none';
	$('polar').style.display = 'none';
	$('body').removeClassName('printLargeInfo');
}

/** polars **/

var counter = 0;
var polarArray = null;

function polar(items)
{
	// move polar element
	var t = $('polar').cloneNode(true);
	$('list-single').removeChild($('polar'));
	document.body.appendChild(t);
	
	$('polar').style.display = 'block';

	// fix height on background
	var backg = $('backgroundWhite');
	backg.style.height = '100%';
	backg.style.display = 'block';
 
		$('currentPol').src = items[0];

	$('body').addClassName('printLargeInfo');
	$('prev').style.display = 'none';

	if(items.length<3)
	{
		$('next').style.display = 'none';
	}
	
	counter = 0;
	polarArray = items;
	
	// fix height
	if(backg.getHeight()*1 < 599)
  	backg.style.height = '599px';
  else
  	backg.style.height = '100%';
  backg.style.display = 'block';
  
}

function polarNextPrev(direction)
{
	if(direction == "next")
	{
		counter += 1;
	}
	
	if(direction == "prev")
	{
		counter -= 1;
				
		$('currentPol').src = polarArray[counter];
	}
	
	checkCounter();
}

function checkCounter()
{		
	if(counter==(polarArray.length-2))
	{
		$('next').style.display = 'none';
	}
	else
	{
		$('next').style.display = 'block';
	}
	if(counter<1)
	{
		$('prev').style.display = 'none';
	}
	else
	{
		$('prev').style.display = 'block';
	}
	
	$('currentPol').src = polarArray[counter];
}

var $j = jQuery.noConflict();
     
// Use jQuery via $j(...)
$j(document).ready(function(){

  $j(".uniquelook").animate({
    opacity: 0.0
  }, 500, function() {
    // Animation complete.
  }).animate({
    opacity: 1.0
  }, 750, function() {
    // Animation complete.
  }).animate({
    opacity: 0.35
  }, 1000, function() {
    // Animation complete.
  });

  $j(".aarhus").animate({
    opacity: 0.0
  }, 250, function() {
    // Animation complete.
  }).animate({
    opacity: 1.0
  }, 500, function() {
    // Animation complete.
  }).animate({
    opacity: 0.35
  }, 1000, function() {
    // Animation complete.
  });
  
  $j(".cph").animate({
    opacity: 1.0
  }, 250, function() {
    // Animation complete.
  }).animate({
    opacity: 0.35
  }, 1000, function() {
    // Animation complete.
  });

  $j(".cph,.aarhus,.uniquelook").hover(
    function () {
      $j(this).animate({
    	opacity: 1.0
  	  }, 0, function() {
    	// Animation complete.
  	  });
    }, 
    function () {
      $j(this).animate({
    	opacity: 0.35
  	  }, 0, function() {
    	// Animation complete.
  	  });    }
  );


});



