$.tools.tabs.addEffect('slider', function(nTab, done) {	$.current = this.getIndex();	$.n_tab = this.getPanes().eq( nTab );	$.c_tab = this.getPanes().eq( $.current );	$.width = $('div.content').width();
	if((nTab < $.current && (nTab != 0 || (nTab == 0 && $.current == 1))) || ($.current == 0 && nTab == (this.getPanes().length - 1))) {    	$.n_tab.css({ left: (-1) * $.width });	    	$.c_tab.animate({ left: $.width });	    } else { // slide right    	$.n_tab.css({ left: $.width });	    	$.c_tab.animate({ left: (-1) * $.width });	    }
	$.n_tab.animate({ left: 22 });	    done.call(); });
$(document).ready(function(){	dsCrossBrowserCheck();	dsInitUI();	dsTabs();
	$('a[rel="_blank"]').click(function() {		window.open($(this).attr('href'));		return false;	});});function dsTabs(){	$('ul.tabs-heading').tabs('div.tabs-content > ul > li', { 		effect: 'default',         fadeOutSpeed: 'fast',        tabs: 'li',          rotate: false    });}
function dsCrossBrowserCheck(){    if($.browser && $.browser.msie && $.browser.version == "6.0"){        //  MSIE 6    	$('#mainmenu ul li').hover(function(){ if($(this).children('ul')){ $(this).children('ul').show(); } }, function(){ if($(this).children('ul')){ $(this).children('ul').hide(); } });    }}
function dsInitUI(){    if($('.home .tabs').length > 0){    	$('ul.tabs').tabs('div.content > div.products', { 			effect: 'fade', 	        fadeOutSpeed: 'fast',	        tabs: 'li',  	        rotate: true	    }).slideshow({	    	autoplay: true,	    	interval: 15000,	    	clickable: false,	    	next: '',	    	prev: ''	    });	    $('div.products').tabs('div.products > div.product-info', { 			effect: 'slider', 	        tabs: 'div.product-info',  	        rotate: false	    }).slideshow({	    	autoplay: true,	    	interval: 6500,	    	clickable: false	    });	    	    $('div.product-info A').click(function(){	    	window.location.href = $(this).attr('href');	    });    }        //  Sidebar Sliding Section    if($('#content .right-col .sliding.section').length > 0){        $('#content .right-col .sliding.section > h3').click(function(){            if($(this).parent().hasClass('expanded')){            	$(this).parent().children('UL').slideUp('fast', function(){                    $(this).parent().removeClass('expanded');            	            	});                            } else {                $(this).parent().children('UL').slideDown('fast', function(){                    $(this).parent().addClass('expanded');                });                            }        });            }
    //  Auto Expand    if($('#content a.auto-expand').length > 0){       $('#content a.auto-expand').click(function(){       	    var target = $(this).attr('rel');       	    if(target != '' && $('#' + target).length > 0){       	        $('#' + target).slideToggle();       	    }            return false;              });     }
    //  Hint    if($('a.showhint-dd').length > 0){    	$('#page').append('<div id="hint-dd"></div>');        $('a.showhint-dd').hover(function(){            var pos = $(this).offset();            $('#hint-dd').html($(this).parent().next('dd').html());            $('#hint-dd').css('left', pos['left'] - $($('#hint-dd')).width() - 10);            $('#hint-dd').css('top', pos['top'] - $('#hint-dd').height() / 2);            $('#hint-dd').css('opacity', 0.3);            $('#hint-dd').show();            $('#hint-dd').animate({opacity: 0.95}, 'fast');        }, 
        function(){        	$('#hint-dd').hide();        });    }
    //  Auto hint for input fields    $('input.auto-hint').each(function(){        if($(this).attr('title') == ''){ return; }        if($(this).val() == ''){ $(this).val($(this).attr('title')); }        $(this).focus(function(){            if($(this).val() == $(this).attr('title')){                 $(this).val('');                $(this).removeClass('auto-hint');            }        });        $(this).blur(function(){        	if($(this).val() == ''){         	   $(this).val($(this).attr('title'));        	   $(this).addClass('auto-hint');        	}        });    });
    //	Initialize Password Recovery From	$('#fm-recovery form').bind('submit', function() {		$(this).hide();		$('#fm-recovery').find('.thank-you').show('slow');		return false;	});
    //	Initialize Overlays    $('.view-overlay').bind('click', function() {    	$(this).overlay({ 		    color: '#333',		    left: 'center', 		    api: true,		    top: 'center',		    speed: 100,		    expose: '#000'    	}).load();    });
	// Initialize Contact Form	$('form.contact').submit(function() {		if($('#contact-output').hasClass('loading')){ return false; }				var text = '';		var email = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
		$('#error-msg').hide();		if($('input[type="radio"]:checked').length == 0) { 			text = 'Please, select inquiry subject.'; 		} else if($('input[name="fullname"]').val() == '') { 			text = 'Please, enter your full name.'; 		} else  if (!email.test($('input[name="email"]').val()) || $('input[name="email"]').val() == 'me@example.com') { 			text = 'Please, enter a valid email address.'; 		} else if($('textarea[name="details"]').val() == '') { 			text = 'Please, enter your message.'; 		}
		if(text != '') {			$('#error-msg').text(text);			$('#error-msg').show('slow');			return false;		}
		$('#contact-output').addClass('loading');		var formData = $(this).serialize();				$.ajax({            type: 'POST', url: $(this).attr('action'), data: formData,             success: function(responseData){                if(responseData.substr(0, 6) == 'ERROR:'){                    $('#error-msg').text(responseData.substr(6, responseData.length - 6));                    $('#error-msg').show('slow');                    $('#contact-output').removeClass('loading');                } else {                	$('#contact-output .contact-content').html('<p>' + responseData + '</p>');                    $('#contact-output').removeClass('loading');                }            },            error: function(){                $('#error-msg').text("An error occured during processing. Please try again.");                $('#contact-output').removeClass('loading');            }        });		return false;	});	if($('a.video').length > 0){		// Initialize Videos				$('a.video').each(function(){			size = $(this).attr('rel');			if(size == null || size == ''){				$(this).fancybox({					'padding': 0,					'autoScale': false,					'transitionIn': 'none',					'transitionOut': 'none'				});			} else {				size = size.split('x');				if(size[0] != '' && size[1] != ''){					$(this).fancybox({						'padding': 0,						'autoScale': false,						'transitionIn': 'none',						'autoDimensions': false,						'transitionOut': 'none',						'width': parseInt(size[0]),						'height': parseInt(size[1])					});				}			}		});	}	if($('div.gallery').length > 0){		$('div.gallery > dl.gallery-item a').fancybox({			'padding': 5,			'cyclic': true,			'transitionIn': 'elastic',			'transitionOut': 'elastic'		});	}	
	if($('.screenshots a').length > 0) {    		//	Initialize Gallery    		$('.screenshots a').fancybox({			'padding': 5,			'cyclic': true,			'transitionIn': 'elastic',			'transitionOut': 'elastic'		});        }
	if($('.news a.toggle').length > 0) {		$.news_block_height = $('.news-list').height();
    	$('a.toggle').click(function() {    		if($('.news').hasClass('expanded')) {     			$('.news-list').animate({ height:  $.news_block_height}, 'fast', function() {	     			$('.news').removeClass('expanded');			    	$.scroll_news_timer = setTimeout('scrollNews()', $.scroll_period);     			});     		} else {     			$('.news-list ul').stop();    			clearTimeout($.scroll_news_timer);    			$('.news-list ul').css({top: 0});    			     			$('.news-list').animate({ height:  $('.news-list ul').outerHeight()}, 'fast', function() {}); 				$('.news').addClass('expanded');     		}    	});    	    	$.scroll_period = 5000;    	$.scroll_news_timer = setTimeout('scrollNews()', $.scroll_period);    }}function scrollNews() {	var scroll_height = parseInt($('.news-list ul').height() / $('.news-list ul li').length );	$('.news-list ul').queue('fx');		if( $('.news-list ul').position().top <= ( (-1) * ($('.news-list ul li').length - 1) * scroll_height ) ) {		$('.news-list ul').animate({top: 0}, 1000);	} else {		$('.news-list ul').animate({top: $('.news-list ul').position().top - scroll_height}, 1000);	}		$.scroll_news_timer = setTimeout('scrollNews()', $.scroll_period);}function dsHPTabsUpdateActiveEl(tab){	if(!tab){ return; }	$('.home .tabs li a').css('border-color', '#D1D1D1');	tab.children('a').css('border-color', '#A8A8A8');    if(tab.next().length > 0){        tab.next().children('a').css('border-color', '#A8A8A8');    }    }
