$(document).ready(function(){	dsCrossBrowserCheck();	dsInitUI();	$('a[rel="_blank"]').click(function(){		window.open($(this).attr('href'));		return 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){    	// Home Page Tabs    	    	dsHPTabsUpdateActiveEl($('.home .tabs li.current'));    	$('.home .tabs li a').click(function(e, mode){    		var productInfo = $(this).parent().children('div.product-info');    		if(!productInfo.length){ return false; }
    		if(mode != 'aniOff'){ $('#product-info').css('opacity', 0.1); }    		$('#product-info .content').html(productInfo.html());    		if(mode != 'aniOff'){ $('#product-info').animate({opacity: 1}, "fast"); }    		$('.home .tabs li.current').removeClass('current');    		$(this).parent().addClass('current');    		dsHPTabsUpdateActiveEl($('.home .tabs li.current'));            return false;    	});    	$('.home .tabs li.current a').trigger('click', 'aniOff');    }
    //  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'] + $(this).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 Contact Form	$('form.contact').submit(function() {		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, supply your full name.'; 		} else  if (!email.test($('input[name="email"]').val()) || $('input[name="email"]').val() == 'me@example.com') { 			text = 'Please, supply a valid email address.'; 		} else if($('textarea[name="message"]').val() == '') { 			text = 'Please, supply your message.'; 		}
		if(text != '') {			$('#error-msg').text(text);			$('#error-msg').show('slow');			return false;		}	});}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');    }    }
