
/* Custom pixel.gif for ifixpng */
$.ifixpng('/system/modules/de.dmc.opencms.solarworldgb.frontend/resources/images/pixel.gif');

function stepLeft(){
	handle(1);
	updateImageflowView();
}

function stepRight(){
	handle(-1);
	updateImageflowView();
}

function updateImageflowView(){
	
	jQuery("#location_site").text(image_data[caption_id]["location"]);
	jQuery("#location_site_ext").text(image_data[caption_id]["location_ext"]);

}

var image_data = new Array;

function insertImageData(image_src, location, location_ext, location_description) {
	var image = new Object();
	image["src"] = image_src;
	image["location"] = location;
	image["location_ext"] = location_ext;
	image["location_description"] = location_description;
	image_data.push(image);
}

/**
 * Does not work as some browsers are not able to displaying a 
 * dynamically builded dom-structure in a right way
 * 
 * @return
 */
function setupImageFlowContainer(){
	/*
	var img_div = document.getElementById(conf_images);
	
	for(var i = 0; i < image_data.length; i++){
		
		var anchor = document.createElement("a");
		var imageflow_image = document.createElement("img");
		anchor.setAttribute("href", "http://dmc-d630-83/imageflow/" + image_data[i]["src"]);

		anchor.setAttribute("rel", "lightbox[roadtrip]");
		imageflow_image.setAttribute("src", "http://dmc-d630-83/imageflow/reflect.php?img=" + image_data[i]["src"] + "&bgc=%23FFFFFF");
		
		imageflow_image.setAttribute("class", "imageflow");
		
		anchor.appendChild(imageflow_image);
		img_div.appendChild(anchor);
	}
	

	initialise();

	updateImageflowView();
	*/
}



function odump(object, depth, max){
	depth = depth || 0;
	max = max || 2;

	if (depth > max)
		return false;

	var indent = "";
	for (var i = 0; i < depth; i++)
		indent += "  ";

	var output = "";  
	for (var key in object){
		output += "\n" + indent + key + ": ";
		switch (typeof object[key]){
			case "object": 
				output += odump(object[key], depth + 1, max); 
				break;
			case "function": 
				output += "function"; 
				break;
			default: 
				output += object[key] + "<br/>"; 
			break;        
		}
	}
	return output;
}
	


	
function toggleFurtherInfoBox(obj_id, isStart){
	jQuery(document).ready(function() {
		
		if(jQuery("#"+obj_id+"_content").is(":hidden")){
			jQuery("#"+obj_id + "_content").show();
			
			if(isStart != true)
				resetFurtherBox(obj_id + "_headline", "furtherInfoBoxHeadline");
		}
		else {
			jQuery("#"+obj_id + "_content").hide();
			if(isStart != true)
				resetFurtherBox(obj_id + "_headline", "furtherInfoBoxHeadlineHover");
		}
	}); 
}

function resetFurtherBox( id, className ){
	jQuery("#"+id).attr("className", className);
}

function registerFurtherBox(id) {
	jQuery("#"+id+"_headline").hover( function(){
		if(jQuery("#"+id+"_content").is(':hidden'))
			$(this).attr("className", "furtherInfoBoxHeadlineHover");
	}, function() {$(this).attr("className", "furtherInfoBoxHeadline");});
	toggleFurtherInfoBox(id, true);	
}




var elms = new Array("TL", "TM", "TR", "ML", "M", "MR", "BL", "BM" ,"BR");

function highlight(obj_id, isHover){
	
	for(var i = 0; i < elms.length; i++){
		
		if(jQuery("#"+obj_id + elms[i])== null)
			continue;
		
		var className = jQuery("#"+obj_id + elms[i]).attr("className");
		if(className == null)
			continue;
		
		
		if(isHover == false)					
			className = className.replace(/Hover/g, "");
		else {
			classes =className.split(" ");
			className=  "";
			for(k = 0; k < classes.length;k++){
				if(classes[k] == " " || classes[k]== "")
					continue;
				
				className = className + " "+ classes[k]+"Hover ";
			}
		}
		
		jQuery("#"+obj_id + elms[i]).attr("className", className);	
    }
}
