﻿jQuery.fn.dwFadingLinks = function(settings) {
	settings = jQuery.extend({
		color: '#ff8c00',
		duration: 500
	}, settings);
	return this.each(function() {
		var original = $(this).css('color');
		$(this).mouseover(function() { $(this).animate({ color: settings.color },settings.duration); });
		$(this).mouseout(function() { $(this).animate({ color: original },settings.duration); });
	});
};



$(document).ready(function() {
    $('.fader').dwFadingLinks({
        color: '#fe6d0c',
        duration: 500
    });
    $('.fadew').dwFadingLinks({
        color: '#fff',
        duration: 500
    });
    $('.fadex').dwFadingLinks({
        color: '#888',
        duration: 500
    });
    
    $("#imFa").css("opacity", "0.4");
    $("#imEn").css("opacity", "0.4");

    $("#imFa").hover(function() { $(this).fadeTo("fast", 1); }, function() { $(this).fadeTo("slow", 0.4); });
    $("#imEn").hover(function () { $(this).fadeTo("fast", 1); }, function () { $(this).fadeTo("slow", 0.4); });

    // Notify
    RefreshNotify = 0;

    $(window).focus(function () {
        RefreshNotify = setInterval("NotifyMethod('')", 10000);
    });

    $(window).blur(function () {
        clearInterval(RefreshNotify);
    });
    
    

});

/* function to fix the -10000 pixel limit of jquery.animate */
//	      $.fx.prototype.cur = function () {
//	          if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) {
//	              return this.elem[this.prop];
//	          }
//	          var r = parseFloat(jQuery.css(this.elem, this.prop));
//	          return typeof r == 'undefined' ? 0 : r;
//	      }

function En2Fa(str) {

    str.replace("0", "۰");
    str.replace("1", "۱");
    str.replace("2", "۲");
    str.replace("3", "۳");
    str.replace("4", "۴");
    str.replace("5", "۵");
    str.replace("6", "۶");
    str.replace("7", "۷");
    str.replace("8", "۸");
    str.replace("9", "۹");
    return str;
}  


function OpenAnalysis(url) {

    var mysample = window.open(url, "analysis_" + url, "height=500,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
    return false;
}

function OpenNews(url) {
    var mysample = window.open(url, 'News_' + url, "height=500,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
    return false;
}


function OpenDP(url) {
    var mysample = window.open(url, 'DP_' + url, "height=500,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
    return false;
}

function OpenArticle(url) {
    var mysample = window.open(url, 'Articles_' + url, "height=500,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
    return false;
}

function OpenVoiceReport(url) {
    var mysample = window.open(url, 'VR_' + url, "height=600,width=730,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
    return false;
}



