// JavaScript Document
var $j = jQuery.noConflict(); 

$j(document).ready(function()
{

	$j('input[type="text"]').addClass(".idleField");
	$j('input[type="text"]').focus(function()
	{
    	$j(this).removeClass(".idleField").addClass("focusField");
		
    	if (this.value == this.defaultValue)
		{ 
    		this.value = "";
		}
		if(this.value != this.defaultValue)
		{
	    	this.select();
	    }
    });
    
	$j('input[type="text"]').blur(function()
	{
		
   		$j(this).removeClass(".focusField").addClass(".idleField");
		
    	if ($j.trim(this.value) == "")
		{
			this.value = (this.defaultValue ? this.defaultValue : "");
		}
    });
	
	$j('textarea[id="comment"]').addClass("idleField");
	$j('textarea[id="comment"]').focus(function()
	{
    	$j(this).removeClass("idleField").addClass("focusField");
		
    	if (this.value == this.defaultValue)
		{ 
    		this.value = "";
		}
		if(this.value != this.defaultValue)
		{
	    	this.select();
	    }
    });
    
	$j('textarea[id="comment"]').blur(function()
	{
		
   		$j(this).removeClass("focusField").addClass("idleField");
		
    	if ($j.trim(this.value) == "")
		{
			this.value = (this.defaultValue ? this.defaultValue : "");
		}
    });
    
  	$j("#afrekenButtons li").hover(
      function () {
        $j(this).addClass("hover");
      }, 
      function () {
        $j(this).removeClass("hover");
      }
    );
    
    $j("div.productThumbItems img").hover(
      function () {
      	var imagesrc = ($j(this).attr('src'));
        $j("div.productBigContainer img").attr('src',imagesrc)
      }, 
      function () {
      }
    );

	$j(".menuSelect").hover(function(){
        $j(this).addClass("hover");
        $j('ol:first',this).css('visibility', 'visible');
    }, function(){
        $j(this).removeClass("hover");
        $j('ol:first',this).css('visibility', 'hidden');
    });
    
	function externalLinks()
	{
	
	
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++)
		{
			var anchor = anchors[i];
			if (anchor.getAttribute("href") &&
				anchor.getAttribute("rel") == "external")
				anchor.target = "_blank";
		}
	}
	window.onload = externalLinks;
	
	swfobject.embedSWF("promoFlashBox.swf", "videoContainer", "618", "408", "9.0.0", false);
});

function popup_taf(windowWidth, windowHeight)
{
  myleft=(screen.width)?(screen.width-windowWidth)/2:100;
  mytop=(screen.height)?(screen.height-windowHeight)/2:100;
  properties = "width="+windowWidth+",height="+windowHeight+", top="+mytop+",left="+myleft;
  window.open("skin/frontend/default/blank/taf/taf.php", "tellafriend_script", properties)
}
