/*
* Copyright 2010 by GlamThumbs Team.
*
* How To Use The Script:
* add to your page this code between inside head tags
* <script type="text/javascript" src="ATBookmarkApp.js"></script> 
* add anchor with void href like this: 
* <a href="javascript:void(0)" onClick="return BookmarkApp.addBookmark(this)">bookmark us</a> 
* 
*/

BookmarkApp = function () {
    var isIEmac = false; /*@cc_on @if(@_jscript&&!(@_win32||@_win16)&& 
(@_jscript_version<5.5)) isIEmac=true; @end @*/
    var isMSIE = (-[1,]) ? false : true;
    var cjTitle = document.title;
    var cjHref = location.href;

    function hotKeys() {
        var ua = navigator.userAgent.toLowerCase();
        var str = '';
        var isWebkit = (ua.indexOf('webkit') != - 1);
        var isMac = (ua.indexOf('mac') != - 1);

        if (ua.indexOf('konqueror') != - 1) {
            str = 'CTRL + B'; // Konqueror
        } else if (window.home || isWebkit || isIEmac || isMac) {
            str = (isMac ? 'Command/Cmd' : 'CTRL') + ' + D'; // Netscape, Safari, iCab, IE5/Mac
        }
        return ((str) ? 'Press ' + str + ' to bookmark this page.' : str);
    }

    function isIE8() {
        var rv = -1;
        if (navigator.appName == 'Microsoft Internet Explorer') {
            var ua = navigator.userAgent;
            var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
            if (re.exec(ua) != null) {
                rv = parseFloat(RegExp.$1);
            }
        }
        if (rv > - 1) {
            if (rv >= 8.0) {
                return true;
            }
        }
        return false;
    }

    function addBookmark(a) {
        try {
            if (typeof a == "object" && a.tagName.toLowerCase() == "a") {
                a.style.cursor = 'pointer';
                if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
                    window.sidebar.addPanel(cjTitle, cjHref, ""); // Gecko
                    return false;   
                } else if (isMSIE && typeof window.external == "object") {
                    if (isIE8()) {
                        window.external.AddToFavoritesBar(cjHref, cjTitle); // IE 8                    
                    } else {
                        window.external.AddFavorite(cjHref, cjTitle); // IE <=7
                    }
                    return false;
                } else if (window.opera) {
                    a.href = cjHref;
                    a.title = cjTitle;
                    a.rel = 'sidebar'; // Opera 7+
                    return true;
                } else {
                    alert(hotKeys());
                }
            } else {
                throw "Error occured.\r\nNote, only A tagname is allowed!";
            }
        } catch (err) {
            alert(err);
        }

    }

    return {
        addBookmark : addBookmark
    }
}();

function mycarousel_initCallback(carousel)
{
    // 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($) {

	$(document).ready( function() {
	
//		$('.more').click(function(){
//			$(this).parent().find('.excerpt').css('display','none');
//			$(this).css('display','none');
//			$(this).parent().find('.full').fadeIn();
//			$(this).parent().parent().css('height','auto');
//			$('.overlay').css('display','block');
//			$(this).parent('.content').parent('.item').parent('.box').css('z-index','1101');
//			$('.close').fadeIn();
//		});
//		
//		$('.close, .overlay').click(function(){
//			$(this).parent().find('.excerpt').fadeIn();
//			$('.more').css('display','block');
//			$(this).parent().find('.full').css('display','none');
//			$(this).parent().parent().css('height','181px');
//			$('.overlay').css('display','none');
//			$(this).parent('.content').parent('.post').parent('.box').removeAttr('style');
//			$('.close').css('display','none');
//		});
		

		jQuery('#gah_nevesht').jcarousel({rtl:'true'});
		jQuery('#dast_nevesht').jcarousel({rtl:'true'});
		jQuery('#aks_nevesht').jcarousel({rtl:true, auto: 2, wrap: 'last', initCallback: mycarousel_initCallback});
		jQuery('#nava_nevesht').jcarousel({rtl:'true'});

		
	});
	
})(jQuery);

