var selected;
var submitter = null;
var dialogWin = null;
var dialogWinIFrame = null;

function submitFunction() {
    submitter = 1;
}
function createDialogWin(){
	if(dialogWin==null){ 
		dialogWin = $("<div></div>");
		dialogWinIFrame = $('<iframe width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" >Your browser does not support IFrames</iframe>');
		$(dialogWin).append(dialogWinIFrame);
		$("body").append(dialogWin);
	}
}
function popupWindow(url) {
  createDialogWin();
  url="http://www.bike-store-berlin.de/popup_image.php?pID=138&imgID=0";  
  $(dialogWinIFrame).attr("src",url);
  
  $(dialogWin).dialog(
	{
		modal: true,
        height: 700,
        width: 900,
		open: function(event, ui) { $(".ui-dialog-titlebar").hide(); }
	}
  );
  //alert("ddd");
	
  /*
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
	*/
}
function closePopupWindow() {
	$(dialogWin).dialog("close");
}

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.getElementById('payment'[0])) {
    document.getElementById('payment'[buttonSelect]).checked=true;
  } else {
    //document.getElementById('payment'[selected]).checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function popupImageWindow(url) {
  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

$(document).ready(function() {
  // Handler for .ready() called.
  $("#products .productover img,#produktcats .productover img").css('opacity','0.7');
  $("#products .productover img,#produktcats .productover img").not('.overlay').css('opacity','0.5');
  $("#products .productover img,#produktcats .productover img").css('zIndex','2');
  $("#products .productover img,#produktcats .productover img").not('.overlay').css('zIndex','1');

  
  var verz= 400;
  $("#products .productover,#produktcats .productover").hover(
        function(){
            var h1css={ textDecoration :'underline'  };
            $(this).find('.product_description,.cat_description').animate( {'backgroundColor' :'#ffffff','backgroundPosition':'-100px'},verz);
            $(this).find('img.overlay').animate( {'opacity' :'1'},verz);
            $(this).find('img').not('.overlay').animate( {'opacity' :'1'},verz);
            $(this).find('.product_description h3 a').css( h1css);
            $(this).find('.black_link').css( {'background':'#38a9e1 url(templates/fnm_style/img/pfeil_hover.gif) no-repeat right'});
        },
        function(){
            var h1css={ textDecoration :'none' };
            $(this).find('.product_description,.cat_description').animate({'backgroundColor' :'#eeeeee','backgroundPosition':'0'},verz);
            $(this).find('img.overlay').animate( {'opacity' :'0.7'},verz);
            $(this).find('img').not('.overlay').animate( {'opacity' :'0.5'},verz);
            $(this).find('.product_description h3 a').css(h1css);
            $(this).find('.black_link').css( {'background':'#333333 url(templates/fnm_style/img/pfeil_black.gif) no-repeat right'});
        }  
  );
  
});
