function chkFormular(aFormPostfix,aPID,aAttID)
{
	// Gruppen Form Element durchlaufen
	attr = $('cart_quantity').getElements('input[name^=product_text_attribute_text]');
	attr.each(function(item, index)
	{
		// alle Varianten Form Elemente durchlaufen
		$$('form[id^=cart_quantity_variants]').each(function(item2, index2)
			{
				item2.getElements('input[name^=product_text_attribute_text]')[index].value = item.value;
			});
	});

	// Alle Produkt Attribute kopieren (ist im Standard XTC bereits enhalten, nur wegen Varianten Erweiterung wird dieses Javascript gebraucht da die Informationen in einem anderen <form> Element sind als die Variante)
	if(aAttID != '')
	{
		splittAttID = aAttID.split(",");

		if(splittAttID)
		{
			for (var i = 0; i < splittAttID.length; i++)
			{
				if(document.forms['cart_quantity'].elements['id['+splittAttID[i]+']'].value)
				{
					var formName = 'cart_quantity_variants_' + aFormPostfix;
					document.forms[formName].elements['id['+splittAttID[i]+']'].value=document.forms['cart_quantity'].elements['id['+splittAttID[i]+']'].value;
				}
			}
		}
	}
}


// *****************************  For AJAX REQUESTS   OF PRODUCTS PIUCTURES ***********************************************
    var http_request = false;

    function setPictureRequestAjax(url, selectedImg) 
	{
        http_request = false;
        if (window.XMLHttpRequest) 
		{ 
			// Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) 
			{
                http_request.overrideMimeType('text/xml');
            }
        } 
		else if (window.ActiveXObject) 
		{ 
			// IE
            try 
			{
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } 
			catch (e) 
			{
                try 
				{
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } 
				catch (e) {}
            }
        }

        if (!http_request) 
		{
			alert('Can not create a XMLHTTP-Instance.');
            return false;
        }
        http_request.onreadystatechange = handleResponse;
        
		// For GET
		// http_request.open('GET', url, true);
        // http_request.send(null);
		
		// For POST
		http_request.open('POST', url, true);
		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http_request.send('selectedImg='+selectedImg);	
		
    }

    function handleResponse() 
	{
        if (http_request.readyState == 4) 
		{
            if (http_request.status == 200) 
			{
                // alert(http_request.responseText);
				var xmldoc = http_request.responseXML;
				var root_node1 = xmldoc.getElementsByTagName('img').item(0);
				//alert(root_node1.firstChild.data);					
				document.getElementById("imagemain").src = root_node1.firstChild.data;						
            } 
			else 
			{
				alert('There was an error by creating the request.');	
            }
        }
    }
	
// *****************************  For NON AJAX REQUESTS  OF PRODUCTS PIUCTURES ***********************************************	
    function setPictureRequest(url, selectedImg) 
	{
		document.getElementById("imagemain").src = selectedImg;
    }	


// ***************************** Function checks integer-value of width and height *******************
	function checkIntegerSubmit(lang) 
	{
		//alert("lang: "+lang);
		
		lfinder_width = document.getElementById("id_lfinder_width").value;
		lfinder_height = document.getElementById("id_lfinder_height").value;
		
		if ( isNaN(lfinder_width) ) 
		{
			if(lang == 'german')
			{
				alert("Fehlerhafte Eingabe im Feld Breite: "+lfinder_width+"\nBitte geben Sie eine Zahl ein.");
			}
			else
			{
				alert("Faulty value in the field width: "+lfinder_width+"\nPlease insert a number.");
			}
			return false;
		}

		if ( isNaN(lfinder_height) ) 
		{
			if(lang == 'german')
			{
				alert("Fehlerhafte Eingabe im Feld Höhe: "+lfinder_height+"\nBitte geben Sie eine Zahl ein.");
			}
			else
			{
				alert("Faulty value in the field height: "+lfinder_height+"\nPlease insert a number.");
			}
			return false;
		}
		
		return true;

	}
	
	function checkInteger(form,lang) 
	{
		//alert("lang: "+lang);
		
		lfinder_width = document.getElementById("id_lfinder_width").value;
		lfinder_height = document.getElementById("id_lfinder_height").value;
  
		if ( isNaN(lfinder_width) ) 
		{
			if(lang == 'german')
			{
				alert("Fehlerhafte Eingabe im Feld Breite: "+lfinder_width+"\nBitte geben Sie eine Zahl ein.");
			}
			else
			{
				alert("Faulty value in the field width: "+lfinder_width+"\nPlease insert a number.");
			}
			return false;
		}

		if ( isNaN(lfinder_height) ) 
		{
			if(lang == 'german')
			{
				alert("Fehlerhafte Eingabe im Feld Höhe: "+lfinder_height+"\nBitte geben Sie eine Zahl ein.");
			}
			else
			{
				alert("Faulty value in the field height: "+lfinder_height+"\nPlease insert a number.");
			}
			return false;
		}
		
		form.submit();
		
	}

