$(document).ready(function() {
	  /*jQuery('#nav_left').accordion({
		header: 'ul ul li',
		active: false,
		alwaysOpen: false,
		animated: false,
		autoheight: false
	});*/
});

	(function($) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
		  var cacheImage = document.createElement('img');
		  cacheImage.src = arguments[i];
		  cache.push(cacheImage);
		}
	  }
	})(jQuery)	
	
	/*jQuery.preLoadImages("/lay/nav_btn_1_act.png", "/lay/nav_btn_2_act.png", "/lay/nav_btn_3_act.png", "/lay/nav_btn_4_act.png", "/lay/nav_btn_5_act.png", "/lay/nav_icon_act.png");*/
	/*Cufon.replace('h1', { fontWeight: 'bold', fontFamily: 'Akkurat'}); // Works without a selector engine
	Cufon.replace('a', { hover: true, fontWeight: 'bold', fontFamily: 'Akkurat'}); // Works without a selector engine
	Cufon.replace('p', { fontWeight: 'normal', fontFamily: 'Akkurat'}); // Works without a selector engine
	Cufon.replace('ul li', { fontWeight: 'normal', fontFamily: 'Akkurat'}); // Works without a selector engine*/
	
	Cufon.replace('h1'); // Works without a selector engine
	Cufon.replace('a', { hover: true}); // Works without a selector engine
	Cufon.replace('p'); // Works without a selector engine
	Cufon.replace('ul li'); // Works without a selector engine

function SetContentsDE(set_value_de)
{
	// Get the editor instance that we want to interact with.
	var oEditor = CKEDITOR.instances.editor1;

	// Set the editor contents (replace the actual one).
	oEditor.setData( set_value_de );
}

function SetContentsEN(set_value_en)
{
	// Get the editor instance that we want to interact with.
	var pEditor = CKEDITOR.instances.editor2;

	// Set the editor contents (replace the actual one).
	pEditor.setData( set_value_en );
}

function get_description(){
	$.ajax({
			   type: "POST",
			   url: "../inc/httprequests/get_description_de.php",
			   data: "id="+$('#fk_variant_id').val(),
			   success: function(msg, textStatus){
				 /* Lädt den Inhalt in die aktuelle CKEditor-Instanz */
				 SetContentsDE(msg);
			   }
			 });
	$.ajax({
			   type: "POST",
			   url: "../inc/httprequests/get_description_en.php",
			   data: "id="+$('#fk_variant_id').val(),
			   success: function(msg, textStatus){
				 /* Lädt den Inhalt in die aktuelle CKEditor-Instanz */
				 SetContentsEN(msg);
			   }
			 });
	$.ajax({
			   type: "POST",
			   url: "../inc/httprequests/get_title_de.php",
			   data: "id="+$('#fk_variant_id').val(),
			   success: function(msg, textStatus){
				 /* Lädt den Inhalt in die aktuelle CKEditor-Instanz */
				 $('#pic_title_deu').val(msg);
			   }
			 });
	$.ajax({
			   type: "POST",
			   url: "../inc/httprequests/get_title_en.php",
			   data: "id="+$('#fk_variant_id').val(),
			   success: function(msg, textStatus){
				 /* Lädt den Inhalt in die aktuelle CKEditor-Instanz */
				 $('#pic_title_eng').val(msg);
			   }
			 });
	$.ajax({
			   type: "POST",
			   url: "../inc/httprequests/get_pdf_attachment.php",
			   data: "id="+$('#fk_variant_id').val(),
			   success: function(msg, textStatus){
				 /* Lädt den Inhalt in die aktuelle CKEditor-Instanz */
				 $('#pdf_attachment').html(msg);
				 $('#pdf_attachment_parent').val($('#fk_variant_id').val());
			   }
			 });
}
