function getProduktAttribute()
{
	try
	{
		hiddenfelderzeugen( "sofortkaufenlink", "AttributSetID", $ID('AttributSetID').value);
		hiddenfelderzeugen( "sofortkaufenlink", "ProduktID", $ID('AttributProduktID').value);
	}catch(e){}
	try
	{
		hiddenfelderzeugen( "warenkorblink", "AttributSetID", $ID('AttributSetID').value);
		hiddenfelderzeugen( "warenkorblink", "ProduktID", $ID('AttributProduktID').value);
	}catch(e){}
	arrElements = getElementsByClassName( "ProduktAttribute", document);
	for(element in arrElements)
	{
		if( arrElements[element].value.length==0)
		{
			arrElements[element].value=arrElements[element].options[0].value;
		}
		try{
		hiddenfelderzeugen( "sofortkaufenlink", arrElements[element].name,  arrElements[element].value);
		}catch(e){}
		try{
		hiddenfelderzeugen( "warenkorblink", arrElements[element].name,  arrElements[element].value);
		}catch(e){}
	}
	return true;
}


var fancyBackground = "";
function showPleaseWait()
{
	$("a#pleasewaitlink").click(); 
	fancyBackground = document.getElementById('fancy_div').style.background;
	document.getElementById('fancy_div').style.background = 'transparent';
}

function hidePleaseWait()
{
	document.getElementById('fancy_div').style.background = fancyBackground;
	document.getElementById('fancy_overlay').style.display = 'none';
	document.getElementById('fancy_outer').style.display = 'none';
	
	parent.$.fn.fancybox.close();
}

function changeAttribute()
{
	showPleaseWait();
	$ID('attributeformid').innerHTML = "";
	hiddenfelderzeugen( "attributeformid", "print", 1);
	hiddenfelderzeugen( "attributeformid", "AttributSetID", $ID('AttributSetID').value);
	hiddenfelderzeugen( "attributeformid", "ProduktID", $ID('AttributProduktID').value);
	arrElements = getElementsByClassName( "ProduktAttribute", document);
	for(element in arrElements)
	{
		if( arrElements[element].value.length==0)
		{
			arrElements[element].value=arrElements[element].options[0].value;
		}
		hiddenfelderzeugen( "attributeformid", arrElements[element].name,  arrElements[element].value);
	}
	hiddenfelderzeugen( "attributeformid", "add", "attributrechnung");
	document.attributeform.submit();
	
}


function hiddenfelderzeugen (strForm, strName, strValue)
{
	var input2 = document.createElement("input");
	input2.type="hidden";
	input2.name=strName;
	input2.value=strValue;
	$ID( strForm).appendChild(input2);
}


function $ID(id)
{
        return document.getElementById(id);
}


function getElementsByClassName(classname, element)
{
    var array = new Array();
    var elements = element.getElementsByTagName('*');
    
    for (var i = 0; i < elements.length; i++) 
    {
        var classes = elements[i].className.split(' ');
        for (var j = 0; j < classes.length; j++) 
        {
            if (classes[j] == classname) 
            {
                array.push(elements[i]);
            }
        }
    }
    return array;    
}


function questionsubmit()
{
	//document.forms.kundenfrage.submit();
}

function iframeload()
{
	try 
	{
		if(typeof window.frames['questionframe'].document.getElementById('question') != undefined)
		{
			document.getElementById('questioncontent').innerHTML = window.frames['questionframe'].document.getElementById('questioncontent1').innerHTML;
			$("a#questionlink").click(); 
		}
		else
		{
		}
		
	}
	catch(e)
	{ 
	}
}

