/**
  * Author: Dmitry Stepanov
  * E-Mail: dmitrij@stepanov.lv
  * URL: http://www.stepanov.lv
  */

(function($){
var api =this;

// show authentication form
api.showAuth =function() {
  $( '#auth')
    // show auth
    .openOverlay();
};

// close authentication form
api.closeAuth =function() {
  $( '#auth')
    // hide auth
    .closeOverlay();
};

// init UI
$(document).ready(function(){
  // initialize auth
  $( '#auth')
    .overlay({
      'align': $.OVERLAY_ALIGN_FIXED,
      'effect': $.OVERLAY_EFFECT_FADE,
      'position': {
        'top': $.OVERLAY_POSITION_CENTER,
        'left': $.OVERLAY_POSITION_CENTER
      }
    });
    
  // remove label from search input
  //$( '#heading input[type="submit"]').attr( 'value', '');
  
  // initialize inputs
  $( '#siteSearch form input[type="text"]')
	.add( '#filters form input[type="text"]')
	// auth
	.add( '#auth form input[type="text"]')
	.add( '#auth form input[type="password"]')
	// content inputs
	.add( '#content input[type="text"][class]')
	.add( '#content input[type="password"][class]')
	.textinput();

	$('#search-products-temp form input[type="submit"]').button();

  $( '#siteSearch form input[type="submit"]')
	// filter "submit" button
	.add( '#filters form input[type="submit"]')
	.add( '#productInfo form input[type="submit"]')
	.add( '#makeOrderButton input[type="submit"]')
	.add( '#updateProfileButton input[type="submit"]')
	.add( '#registerButton input[type="submit"]')

	// product buttons
	.add( '.product input[type="button"]')
	// auth button
	.add( '#auth input[type="submit"]')
	// content inputs
	.add( '#content input[type="button"][class]')
	.button();
	
  $( '#filters form.filters select')
  // content inputs
  .add( '#content select[class]')
	.simpleSelectbox();
	
  // insert flash content in background
  /*
  $( '#background')
	.html(
	  '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0">' +
		'<param name="movie" value="' + myhostname + 'swf/bg.swf?list=tmp/list.txt&amp;speed=4&amp;wait=100&amp;next_alpha=50" />' +
		'<param name="menu" value="false" />' +
		'<param name="quality" value="high" />' +
		'<param name="scale" value="noscale" />' +
		'<param name="wmode" value="transparent" />' +
		'<embed src="' + myhostname + 'swf/bg.swf?list=tmp/list.txt&amp;speed=4&amp;wait=100&amp;next_alpha=50" menu="false" quality="high" scale="noscale" wmode="transparent" />' +
	  '</object>'
	);
	*/
	
	$( '#auth')
	 // hide auth initially
	 .hide();

	$('table.shops tr td:first-child a').lightBox();
	 
});

}).call( window, jQuery);

