function setimgcolor(thisimage)
{
	thisimage.src = thisimage.src.replace("&fltr[]=gray","");
}

function setimggray(thisimage)
{
	thisimage.src = thisimage.src + "&fltr[]=gray";
}	

var lastZoomID="";

function SetOnLoad(c,n)
{
	
	getElementById('zoomfoto'+n).onload=zoom(c,n);
	
}	


function zoom(c,n,extraheight)
{
	screenw = window.screen.width;
	screenh = window.screen.height;
	
	if (c=="in")
	{
		with (document)
		{
	
			zoomwidth = getElementById('zoomfoto'+n).width;
			zoomheight = getElementById('zoomfoto'+n).height+extraheight;
			
			getElementById('zoom'+n).style.width=zoomwidth+"px";
			getElementById('zoom'+n).style.height=zoomheight+"px";
			
			
			x= (screenw - zoomwidth)/2
			y = (screenh - zoomheight-200)/2
			
			getElementById('zoom'+n).style.top = y+"px";
			getElementById('zoom'+n).style.left = x+"px";
			
			getElementById('zoom'+n).style.visibility = "visible";
			
			//setTimeout('effect_show_finish(\''+ 'zoom'+n +'\')', 1000);
			
			if(lastZoomID!="" && lastZoomID!=n)
			getElementById('zoom'+lastZoomID).style.visibility = "hidden";
			
			lastZoomID=n;
			
			
		}
	} else {
		with (document)
		{
			getElementById('zoom'+n).style.visibility = "hidden";
			//getElementById('foto'+n).style.visibility = "visible";
		}
	}
}

function QuickSubmitSearch()
{
	if(document.qsearchform.qsearch.value!="")
	document.qsearchform.submit();
}

function QuickSearch(searchurl)
{
	document.location.href = searchurl + document.getElementById("qsearch").value;
}	

function GetCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function SetCookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}


//MENU SCRIPTS

function showdiv(div_id,p_div_id)
{
	var menudiv = document.getElementsByTagName("div"); 
	
	SetCookie( 'menuid',p_div_id, '', '/', '', '' );
	
	if(document.getElementById(div_id))
	{
		parentdiv = p_div_id;
		for (var i = 0; i < menudiv.length; i++) { 
		      if ( menudiv[i].className == "menudiv") {
		     	{
		     		if(menudiv[i].id==div_id)	 
		      		menudiv[i].style.display = "block";
		     	else
		   	  	menudiv[i].style.display = "none";	     
		   	  }
		    }
		}
	}
}

function startdiv(div_id,p_div_id)
{
	
		SetCookie( 'menuid', div_id, '', '/', '', '' );
		
		var menudiv = document.getElementsByTagName("div");
		for (var i = 0; i < menudiv.length; i++) { 
		      if ( menudiv[i].className == "menudiv") {
		     	{
		     		if(menudiv[i].id==div_id)	 
		      		menudiv[i].style.display = "block";
		     	else
		   	  	menudiv[i].style.display = "none";	     
		   	  }
		    }
		}
	
}	

function showparentdiv()
{
	 if(parentdiv!="")
	 showdiv(parentdiv);
}	


function effect_showdiv(div_id,p_div_id)
{
	
	if(document.getElementById(div_id))
	{
		SetCookie( 'menuid',div_id, '', '/', '', '' );
		
		//addDiv(div_id,p_div_id);
	
		new Effect.Fade(document.getElementById(last_div_id));
		last_div_id = div_id;
		setTimeout('effect_show_finish(\''+ div_id +'\')', 1000);
		//new Effect.Appear(document.getElementById(div_id));
	}
}

function effect_show_finish(div_id)
{
	new Effect.Appear(document.getElementById(div_id));
}

function effect_showparentdiv(child_id)
{
	 if(findDiv(child_id)!="")
	 effect_showdiv(findDiv(child_id));
}


function findDiv(childdiv)
{
	for(var i=0; i<=counter; i++)
	{
		if(childDivArray[i]==childdiv)
		return parentDivArray[i];
	}	
	
	return "";	
}	

function addDiv(childdiv,parentdiv)
{
	childDivArray[counter]=childdiv;	
	parentDivArray[counter]=parentdiv;
	counter++;
}	




function HighlightMenulink(thisurl)
{
	
	var menulinks = document.getElementsByTagName("a"); 
	
	for (var i = 0; i < menulinks.length; i++) { 
	      if ( menulinks[i].className == "menulink") {
	     	
	     		//if(menulinks[i].href.indexOf(thisurl)==0)
	     		if(menulinks[i].href==thisurl)
	      		{
	      			menulinks[i].className = "menulink_selected";
	      			SetCookie( 'menulink',thisurl, '', '/', '', '' );
	      			return true;
	      		}
	     	  
	   	  }
	    }
	
}

function GoToPage(page)
{
	document.searchnavigation.Page.value=page;
	document.searchnavigation.submit();
}	

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function OnLoadFunctions()
{
	
	
	
}


function CacheImages(IArray)
{
  if (!document.images) return;

  for (var i=0; i<IArray.length; i++)
  {
    ImageObjects[i] = new Image();
    ImageObjects[i].src = IArray[i];
  }
}

function SetImage(ImageObjectId,ImageIndex)
{
	//alert(document.getElementById(ImageObjectId));
	//alert(ImageObjects[0]);
	if(ImageIndex!=-1)
	document.getElementById(ImageObjectId).src = ImageObjects[ImageIndex].src;
	else
	document.getElementById(ImageObjectId).src = DefaultImage.src;
}

function SetDefaultImage(ImageObjectId,ImageIndex)
{
	document.getElementById(ImageObjectId).src = ImageObjects[ImageIndex].src;
	DefaultImage.src = ImageObjects[ImageIndex].src;
}


function ViewImage(thislink)
{
	var keywordUrl = thislink;
	
	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;
	
	var w=200;
	var h=300;
	
	var windowFeatures = 'dependent=0,width=' + w+ ',height=' + h + ',left=' + (scW-w)/2 + ',top=' + (scH-h)/2 + ',menubar=0,scrollbars=1,status=0,titlebar=0,toolbar=0,resizable=1';
	
	wishlist_window = window.open(keywordUrl, 'FWWishlistWindow', windowFeatures);
	wishlist_window.focus();
}



image_height_extra = 10;
image_width_extra = 10;

	
function resizeWinTo() {
	
if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }

var oH = document.images[0].height, oW = document.images[0].width;

if( !oH || window.doneAlready ) { return; }

window.doneAlready = true;
var x = window; x.resizeTo( oW  + 10, oH + 10);

var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }

if( window.opera && !document.childNodes ) { myW += 16; }

oW = oW + ( ( oW + 20 ) - myW ) + image_width_extra;
oH = oH + ( (oH + 20 ) - myH ) + image_height_extra;

x.resizeTo(oW,oH);

var scW = screen.availWidth ? screen.availWidth : screen.width;
var scH = screen.availHeight ? screen.availHeight : screen.height;

if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }
}