/*function $(id)
{
	return document.getElementById(id);
}*/





var it;

function scroll_up()
{
	d = -10;
	it = setInterval(scroll_engine,50);
}

function scroll_down()
{
	d = 10;
	it = setInterval(scroll_engine,50);
}


function scroll_left()
{
	d = -10;
	it = setInterval(scroll_engine_vert,50);
}

function scroll_right()
{
	d = 10;
	it = setInterval(scroll_engine_vert,50);
}





function scroll_stop()
{
	clearInterval(it);
}

function scroll_engine()
{
	$('Text').scrollTop += d;
}

function scroll_engine_vert()
{
	$('Text').scrollLeft += d;
}




function ie6(id)
{
	if(fixie)
	{
		if($('ul_'+id))
			$('ul_'+id).style.visibility = 'visible';
	}
}

function ie6bg(id)
{
	if(fixie)
	{
		$(id).style.background = '#e8e8e8 url(img/hover_bg.jpg) right no-repeat'
		$(id).getElementsByTagName('a')[0].style.color = "#0b58a0";
	}
}

function ie6bg_hide(id)
{
	if(fixie)
	{
		$(id).style.background = '';
		$(id).getElementsByTagName('a')[0].style.color = "white";
	}
}

function ie6_hide(id)
{
	if(fixie)
	{
		if($('ul_'+id))
			$('ul_'+id).style.visibility = 'hidden';
	}
}


function load_product(path, img, price, name)
{
	//$('PhotoBigger').src = 'images/' + path + 'wieksze/' + img + '.jpg';
	//$('LinkDivA').href = 'images/' + path + 'big/' + img + '.jpg';
	$('PhotoBigger').src = 'img' + path;
	$('LinkDivA').href = 'img' + img;
	$('InfoDivH').innerHTML = name;
	$('InfoDivPrice').innerHTML = price;
	$('InfoDivWrapper').style.visibility = 'visible';
}



window.onload = function()
{
	if($('Text'))
	{
		if($('Text').clientHeight > 350)
		{
			$('Text').style.height = '350px';
			$('Text').style.overflow = 'hidden';
			$('Text').style.display = 'block';
		}
	}
	//if(fixie)
	{
//		var items = document.getElementsByName('menuitem');
//		for(i=0; i<items.length; ++i)
		{
//			document.getElementById('menuitem1').attachEvent("onmouseover",ie6);
		}
	}
}
function okno_no_scroll(url, width, height) {
        width1=width/2;
		height1=height/2;
		x=screen.availWidth/2-width1;
		y=screen.availHeight/2-height1;
		var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0, scrollbars=0, menubar=no,status=1, left='+x+', top='+y );
		Win.focus();
};

function img(n)
	{
		document.getElementById('cnt').src = 'files/image/inspiracje/'+n + '.jpg';
	}


function walidacja_kartki()
{
	if(!document.getElementById('OrderImie').value || !document.getElementById('OrderEmail').value || !document.getElementById('OrderOimie').value || !document.getElementById('OrderOemail').value ){
		alert('Proszę uzupełnić wymagane dane');
		return false;
		}
	reg = /^[a-zA-Z0-9_\-\.]{1,30}@[a-zA-Z0-9_\-\.]+(\.[a-zA-Z0-9_\-\.]+)+$/;
	wyn = document.getElementById('OrderEmail').value.match(reg);
	owyn = document.getElementById('OrderOemail').value.match(reg);
	if((!document.getElementById('OrderEmail').value) || wyn == null || (!document.getElementById('OrderOemail').value) || owyn == null)
	{
				alert("Proszę poprawnie uzupełnić pola 'E-mail'");
				return false;
	};
	return true;
}

function walidacja_kartki_first()
{
	if(!document.getElementById('CardZyczenia').value || !document.getElementById('CardKartka').value  ){
		alert('Proszę wybrać kartki i życzenia');
		return false;
		}
	return true;
	
}


function walidacja_konkurs()
{
	if(!document.getElementById('WallpaperName').value || !document.getElementById('WallpaperEmail').value  ){
		alert('Proszę wypełnić nick i adres e-mail');
		return false;
		}
	return true;
	
}

/*
function mycarousel_initCallback(carousel)
{
	
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
		//$('#HomeImg').html('<img alt="" src="" />');
		alert(carousel.options.scroll);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
	
    jQuery('#mycarousel-next-home').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev-home').bind('click', function() {
        carousel.prev();
        return false;
    });


	
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
    
};

function mycarousel_itemCallback(carousel, state)
{
    // for (var i = carousel.first; i <= carousel.last; i++) {
        // Check if the item already exists
      //  if (!carousel.has(i)) {
            // Add the item
		  carousel.remove(carousel.first-1);
          carousel.add(carousel.last + 1, "I'm item #" + carousel.last+1);
		  carousel.size++;
      //  }
 //   }
/* 
	// for (var i = carousel.first; i <= carousel.last; i++) {
        // Check if the item already exists
        carousel.remove(carousel.first-1);
		//if (!carousel.has(carousel.first-1)) {
            // Add the item
            carousel.add((carousel.last)+1, "I'm item #" + (carousel.last)+1);
			carousel.size++;
       // }
   // }
*/
/*
	 console.log(carousel.size);	
}


$(document).ready(function() {
    $('#mycarousel-home').jcarousel({
        auto: 1,
		//wrap: 'circular',
		scroll: 1,
        initCallback: mycarousel_initCallback,
		vertical: true,
		animation: 'slow',
		itemLoadCallback: mycarousel_itemCallback
    })

});
*/

$(document).ready(function(){
	
	$('#mycarousel-home').galleryView({
		panel_width: 760,
		panel_height: 440,
		frame_width: 165,
		frame_height: 120,
		filmstrip_position: 'right',
		background_color: 'transparent',
		transition_speed: 1200
		

		
	//	pause_on_hover: true
	});
})