/**
 * Class BasicClass
 * Letzte Änderung: 23.05.2008
 * 
 * @author     David Grimm, IMG <david.grimm@imgworld.com>
 * @copyright  2008 IMG
 */ 
function BasicClass()
{
	// Variablen definieren
	object 	= this;
    
	/**
	 * Zum vorherigen Bild wechseln
	 * 
	 * @param	Int		pid, Bild-ID
	 * @param	Int		cid, Kategorie-ID
	 * @param	Int		num_all, Anzahl der Bilder einer Kategorie
	 * @param	String	cid_name, Kategoriename
	 */
	this.prePicture = function(pid,cid,num_all,cid_name)
	{
		x_prePicture(pid,cid,num_all,cid_name,pictureSwitchResponse);
	}
	
	/**
	 * Zum nächsten Bild wechseln
	 * 
	 * @param	Int		pid, Bild-ID
	 * @param	Int		cid, Kategorie-ID
	 * @param	Int		num_all, Anzahl der Bilder einer Kategorie
	 * @param	String	cid_name, Kategoriename
	 */
	this.nextPicture = function(pid,cid,num_all,cid_name)
	{
		x_nextPicture(pid,cid,num_all,cid_name,pictureSwitchResponse);
	}
	
	/**
	 * Bild per Mail verschicken
	 */
	this.sendPicturePerMail = function()
	{
		var from 		= document.getElementById('from');
		var from_email	= document.getElementById('from_email');
		var email 		= document.getElementById('receiver');
		var text		= document.getElementById('additional');
		var pid			= document.getElementById('pid').value;
		var cid			= document.getElementById('cid').value;
		var cid_name	= document.getElementById('cid_name').value;
		
		var err		= 0;
		
		if(from.value == "")
		{
			err += 1;
		}
		
		if(from_email.value == "")
		{
			err += 1;
		}
		
		if(email.value == "")
		{
			err += 1;
		}
		
		if(text.value == "")
		{
			err += 1;
		}
		
		if(err < 1)
		{
			document.getElementById('sendError').style.display = "none";
			x_sendPicturePerMail(pid,cid,cid_name,from.value,from_email.value,email.value,text.value,sendPicturePerMailResponse);
		}
		else
		{
			document.getElementById('sendError').style.display = "block";
			document.getElementById('sendResult').style.display = "none";
		}
	}
	
	/**
	 * Bild per Mail verschicken, RESPONSE
	 * 
	 * @param	Mixed	response, AJAX-Antwort
	 */
	function sendPicturePerMailResponse(response)
	{
		document.getElementById('sendResult').style.display = "block";
	}
	
	/**
	 * Bild wechseln, RESPONSE
	 * 
	 * @param	Mixed	response, AJAX-Antwort
	 */
	function pictureSwitchResponse(response)
	{
		var picture_file		= response[0];
		var picture_position	= response[1];
		var picture_num_all		= response[2];
		var category			= response[3];
		var category_id			= response[4];
		var picture_id			= response[5];
		
		location.href			= '/sportch/fanreporter/index.php?action=view_picture&cid=' + category_id + '&pid=' + picture_id;
		
		/*
		ALTE LÖSUNG, Wechseln der Bilder per AJAX
		Rausgenommen: 23.05.2008
		
		document.getElementById('pid').value 				= picture_id;
		document.getElementById('cid').value 				= category_id;
		document.getElementById('cid_name').value 			= category;
		
		document.getElementById('sendError').style.display 	= "none";
		document.getElementById('sendResult').style.display = "none";
		document.getElementById('receiver').value 			= "";
		document.getElementById('additional').value 		= "Schau dir mal dieses Bild an!";
		
		document.getElementById('picturesNum').innerHTML	= picture_position + '/' + picture_num_all;
		document.getElementById('picture').innerHTML		= '<img src="/sportch/fanreporter/data/' + category + '/' + picture_file + '" border="0" />';
		
		if(picture_position == 1)
		{
			document.getElementById('preLink_Box').innerHTML	= '&nbsp;';	
		}
		else
		{
			document.getElementById('preLink_Box').innerHTML	= '<img src="/de/includes/nav/images/pre.gif" border="0" />&nbsp;<a href="javascript:obj_basic.prePicture(' + picture_position + ',' + category_id + ',' + picture_num_all + ',\'' + category + '\');" id="preLink" style="font-family:Arial;font-size:12px;text-decoration:none;color:#000000;">vorheriges Bild</a>';
		}
		
		if(picture_position == picture_num_all)
		{
			document.getElementById('nextLink_Box').innerHTML	= '&nbsp;';	
		}
		else
		{
			document.getElementById('nextLink_Box').innerHTML	= '<a href="javascript:obj_basic.nextPicture(' + picture_position + ',' + category_id + ',' + picture_num_all + ',\'' + category + '\');" id="nextLink" style="font-family:Arial;font-size:12px;text-decoration:none;color:#000000;">nächstes Bild</a>&nbsp;<img src="/de/includes/nav/images/next.gif" border="0" />';
		}
		*/
	}
}