// JavaScript Document

var submitter = null;
function submitFunction() {
   submitter = 1;
   }
//Bonus ende

	function jump(fe,org_uri){
    var opt_key = fe.selectedIndex;
    var uri_val = org_uri + fe.options[opt_key].value;
    window.open(uri_val,'_top');
    return true;
}

		
function clickclear(thisfield, defaulttext) 
{
	if (thisfield.value == defaulttext) 
	{
		thisfield.value = "";
	}
}	

/// bestellabschluss
var submittedAlready = false;

function disablebutton() 
{
	//alert(submittedAlready);
	if(submittedAlready) {
		return false;
	} else {
		submittedAlready = true;
		return true;
  	}
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

var tabsearch = new Array;

function formreset(formular,feld){
 if (tabsearch[feld] != feld){
 eval('document.'+formular+'.'+feld+'.value=""');
 tabsearch[feld] = feld; }

}

function checkRaceClassCombo(rasse,klasse,mode)
{
	var myArray = [];

	/// Human
	myArray[3272]=[];
	myArray[3272][3285] = '1';	/// Priest
	myArray[3272][3286] = '1';	/// Rogue
	myArray[3272][3288] = '1';	/// Warrior
	myArray[3272][3283] = '1';	/// Mage	
	myArray[3272][3282] = '0';	/// Druid
	myArray[3272][3287] = '1';	/// Warlock
	myArray[3272][3289] = '0';	/// Shaman
	myArray[3272][3284] = '1';	/// Paladin
	myArray[3272][3281] = '1';	/// Deathknight
	myArray[3272][3463] = '0';	/// Hunter

	/// Dwarf
	myArray[3273]=[];	
	myArray[3273][3285] = '1';	/// Priest
	myArray[3273][3286] = '1';	/// Rogue
	myArray[3273][3288] = '1';	/// Warrior
	myArray[3273][3283] = '0';	/// Mage	
	myArray[3273][3282] = '0';	/// Druid
	myArray[3273][3287] = '0';	/// Warlock
	myArray[3273][3289] = '0';	/// Shaman
	myArray[3273][3284] = '1';	/// Paladin
	myArray[3273][3281] = '1';	/// Deathknight
	myArray[3273][3463] = '1';	/// Hunter

	/// Nachtelf
	myArray[3278]=[];
	myArray[3278][3285] = '1';	/// Priest
	myArray[3278][3286] = '1';	/// Rogue
	myArray[3278][3288] = '1';	/// Warrior
	myArray[3278][3283] = '0';	/// Mage	
	myArray[3278][3282] = '1';	/// Druid
	myArray[3278][3287] = '0';	/// Warlock
	myArray[3278][3289] = '0';	/// Shaman
	myArray[3278][3284] = '0';	/// Paladin
	myArray[3278][3281] = '1';	/// Deathknight
	myArray[3278][3463] = '1';	/// Hunter
	
	/// Gnom
	myArray[3271]=[];
	myArray[3271][3285] = '0';	/// Priest
	myArray[3271][3286] = '1';	/// Rogue
	myArray[3271][3288] = '1';	/// Warrior
	myArray[3271][3283] = '1';	/// Mage	
	myArray[3271][3282] = '0';	/// Druid
	myArray[3271][3287] = '1';	/// Warlock
	myArray[3271][3289] = '0';	/// Shaman
	myArray[3271][3284] = '0';	/// Paladin
	myArray[3271][3281] = '1';	/// Deathknight
	myArray[3271][3463] = '0';	/// Hunter
	
	/// Draenei
	myArray[3270]=[];
	myArray[3270][3285] = '1';	/// Priest
	myArray[3270][3286] = '0';	/// Rogue
	myArray[3270][3288] = '1';	/// Warrior
	myArray[3270][3283] = '1';	/// Mage	
	myArray[3270][3282] = '0';	/// Druid
	myArray[3270][3287] = '0';	/// Warlock
	myArray[3270][3289] = '1';	/// Shaman
	myArray[3270][3284] = '1';	/// Paladin
	myArray[3270][3281] = '1';	/// Deathknight
	myArray[3270][3463] = '1';	/// Hunter
	
	/// Ork
	myArray[3274]=[];
	myArray[3274][3285] = '0';	/// Priest
	myArray[3274][3286] = '1';	/// Rogue
	myArray[3274][3288] = '1';	/// Warrior
	myArray[3274][3283] = '0';	/// Mage	
	myArray[3274][3282] = '0';	/// Druid
	myArray[3274][3287] = '1';	/// Warlock
	myArray[3274][3289] = '1';	/// Shaman
	myArray[3274][3284] = '0';	/// Paladin
	myArray[3274][3281] = '1';	/// Deathknight
	myArray[3274][3463] = '1';	/// Hunter
	
	/// Untot
	myArray[3277]=[];
	myArray[3277][3285] = '1';	/// Priest
	myArray[3277][3286] = '1';	/// Rogue
	myArray[3277][3288] = '1';	/// Warrior
	myArray[3277][3283] = '1';	/// Mage	
	myArray[3277][3282] = '0';	/// Druid
	myArray[3277][3287] = '1';	/// Warlock
	myArray[3277][3289] = '0';	/// Shaman
	myArray[3277][3284] = '0';	/// Paladin
	myArray[3277][3281] = '1';	/// Deathknight
	myArray[3277][3463] = '0';	/// Hunter
	
	/// Tauren
	myArray[3275]=[];
	myArray[3275][3285] = '0';	/// Priest
	myArray[3275][3286] = '0';	/// Rogue
	myArray[3275][3288] = '1';	/// Warrior
	myArray[3275][3283] = '0';	/// Mage	
	myArray[3275][3282] = '1';	/// Druid
	myArray[3275][3287] = '0';	/// Warlock
	myArray[3275][3289] = '1';	/// Shaman
	myArray[3275][3284] = '0';	/// Paladin
	myArray[3275][3281] = '1';	/// Deathknight
	myArray[3275][3463] = '1';	/// Hunter

	/// Troll
	myArray[3276]=[];
	myArray[3276][3285] = '1';	/// Priest
	myArray[3276][3286] = '1';	/// Rogue
	myArray[3276][3288] = '1';	/// Warrior
	myArray[3276][3283] = '1';	/// Mage	
	myArray[3276][3282] = '0';	/// Druid
	myArray[3276][3287] = '0';	/// Warlock
	myArray[3276][3289] = '1';	/// Shaman
	myArray[3276][3284] = '0';	/// Paladin
	myArray[3276][3281] = '1';	/// Deathknight
	myArray[3276][3463] = '1';	/// Hunter
	
	/// Blutelf
	myArray[3269]=[];
	myArray[3269][3285] = '1';	/// Priest
	myArray[3269][3286] = '1';	/// Rogue
	myArray[3269][3288] = '0';	/// Warrior
	myArray[3269][3283] = '1';	/// Mage	
	myArray[3269][3282] = '0';	/// Druid
	myArray[3269][3287] = '1';	/// Warlock
	myArray[3269][3289] = '0';	/// Shaman
	myArray[3269][3284] = '1';	/// Paladin
	myArray[3269][3281] = '1';	/// Deathknight
	myArray[3269][3463] = '1';	/// Hunter
	
	/// optionswerte resetten
	for (i=0; i <= $(klasse).options.length - 1;i++)
	{
		$(klasse).options[i].disabled=false;
	}
	/// selectedIndex resetten
	$(klasse).selectedIndex=0;
	
	/// geh mir alle keys des rasse-arrays durch und schau welchen wert der hat
	for(key in myArray[$(rasse).value])
	{
		/// wenn du einen hast, der nicht passt, dann schau ob du den findest und disable ihn
		if(myArray[$(rasse).value][key]==0)
		{
			/// geh mal die ganzen optionswerte durch
			for (i=0; i <= $(klasse).options.length - 1;i++)
			{
				/// der hier soll disabled werden
				if($(klasse).options[i].value==key)
				{
					/// schau mal ob der selected ist
					if(i==$(klasse).selectedIndex)
						$(klasse).selectedIndex=i+1;
					$(klasse).options[i].disabled=true;
				}
			}	
		}
	}
}