var $ =	function (eName)													
	{
		return document.getElementById(eName);	
	};
function xGetInt(str, float)												
{
	if(typeof(float) == "undefined")
		float = false;
	var STR = "";
	var neg = (str.charAt(0) == '-')?true:false;
	for(var i=0; i<str.length; i++)
		if(str.charAt(i) in ['0','1','2','3','4','5','6','7','8','9'])
			STR += str.charAt(i);
		else if(float && str.charAt(i) == '.')
			STR += '.';
	if(neg)
		return STR * -1;
	else
		return STR * 1;
}


var browser = 'unknown';													
Mbr = navigator.userAgent.toLowerCase();
if (Mbr.indexOf("opera") != -1)
	browser = 'opera';
else if (Mbr.indexOf("msie") != -1)
	browser = 'msie';
else if (Mbr.indexOf("gecko") != -1)
	browser = 'gecko';
var _xImages = new Array();

function moveIt(obj, attr, start, end, cmd, speed)							
{
	if(typeof(obj) != "object")
		obj = $(obj);
	if(typeof(speed) == "undefined")
		speed = 9;
	if(typeof(attr) == "undefined")
		attr = 'style.left';
	
	var step = Math.round(Math.abs(start-end)/speed);
	var move = Math.abs(end - start);
	var startPos = start;
	for(i=0;i<=step;i++){
		move = Math.ceil((end - startPos)/speed);
		if(start > end)
			move --;
		if((startPos+move >= end && start <= end) || (startPos+move <= end && start > end))
			break;
		setTimeout('$("'+obj.id+'").'+attr+' = "'+(startPos+move)*-1+'px";', i*50);
		startPos += move; 
	}	
	setTimeout('$("'+obj.id+'").'+attr+' = "'+end*-1+'px";', i*50);
	setTimeout('try{'+cmd+';}catch(e){}', i*50);
}

var Class = function(properties)											
{
	var klass = function(){
		if (this.initialize && arguments[0] != 'noinit') return this.initialize.apply(this, arguments);
		else return this;
	};
	for (var property in this) klass[property] = this[property];
	klass.prototype = properties;
	return klass;
};
Class.empty = function(){};
Class.prototype = 															{
	extend: function(properties){
		var pr0t0typ3 = new this('noinit');

		var parentize = function(previous, current){
			if (!previous.apply || !current.apply) return false;
			return function(){
				this.parent = previous;
				return current.apply(this, arguments);
			};
		};

		for (var property in properties){
			var previous = pr0t0typ3[property];
			var current = properties[property];
			if (previous && previous != current) current = parentize(previous, current) || current;
			pr0t0typ3[property] = current;
		}
		return new Class(pr0t0typ3);
	},
	implement: function(properties){
		for (var property in properties) this.prototype[property] = properties[property];
	}

};



	
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
var xpopupWin = new Class({
	initialize: function(name, OBJ, width, caption){
			this.winMainPage = '../global/index.php';
			this.winObj = OBJ;
			this.winName = name;			
			this.winCaption = (typeof(caption)=='undefined')?OBJ:caption;
			this.winStatus = 'none';
			this.winLastPage = '';
			this.winHtml =		
				'<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">'+
					'<tr>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -305px; width:15px; height:15px"></td>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -320px; width:15px; height:15px"></td>'+
					'</tr>'+
					'<tr>'+
						'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat"></td>'+
						'<td>'+
							'<div>'+
								'<div style="width:100%;height:23px;background:url(include/bannerchanger/imgs/xwindows.gif) repeat-x 0px -495px;border:1px solid #969696;border-bottom:0;">'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnClose" width="19" height="19" alt="" title="بستن پنجره" style="margin:2px 4px 2px 2px; float:right" />'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnNewOpen" width="19" height="19" alt="" title="نمايش در پنجره مجزا" style="margin:2px 0px; float:right;" />'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnMinimize" width="19" height="19" alt="" title="تغيير وضعيت پنجره" style="margin:2px; float:right" />'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnReload" width="19" height="19" alt="" title="بارگذاری مجدد" style="margin:2px 5px; float:right" />'+
									'<div id="'+this.winName+'Title" style="width:140px;float:right;padding:2px 10px 0;text-align:right"></div>'+
								'</div>'+
								'<div style="width:100%; background:#FFFFFF;border:1px solid #969696; border-bottom:0;">'+
									'<table id="'+this.winName+'MainTable" border="0" cellpadding="0" cellspacing="5" style="width:100%;; background:#DADADA">'+
									  '<tr>'+
										'<td align="center" id="'+this.winName+'Container">'+
										'</td>'+
									  '</tr>'+
									'</table>'+
								'</div>'+
								'<div style="width:100%;height:20px;background:#FFFFFF url(include/bannerchanger/imgs/xwindows.gif) no-repeat left -475px;text-align:right;border:1px solid #969696;color:#666666;" id="'+this.winName+'Status"></div>'+
							'</div>'+
						'</td>'+
						'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat"></td>'+
					'</tr>'+
					'<tr>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -335px; width:15px; height:15px"></td>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
						'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -350px; width:15px; height:15px"></td>'+
					'</tr>'+
				'</table>';
			this.loadingHtml = 	
				'<div class="whiteBoxHolder" style="margin:0;  width:300px;text-align:left">'+
					'<div class="BoxHeader"><div></div></div>'+
					'<div class="BoxContent" style="margin:0; padding:100px 0;">'+
					'<table border="0" cellpadding="0" cellspacing="0" width="100px" style="margin:0 auto">'+
					  '<tr>'+
						'<td>لطفاً صبر کنيد</td>'+
						'<td><img src="imgs/iconTimeout.gif" width="1" height="1" style="visibility:hidden" alt="" /><img src="imgs/loading.gif" width="16" height="16" alt="" /></td>'+
					  '</tr>'+
					'</table>'+
					'</div>'+
					'<div class="BoxFooter""><div></div></div>'+
				'</div>';
			this.errorHtml = 	
				'<div class="whiteBoxHolder" style="margin:0;  width:300px;text-align:left">'+
					'<div class="BoxHeader"><div></div></div>'+
					'<div class="BoxContent" style="margin:0; padding:100px 0;">'+
					'<table border="0" cellpadding="0" cellspacing="0" width="300" style="margin:0 auto; text-align:right; padding:20px;">'+
					  '<tr>'+
						'<td></td>'+
						'<td><img src="imgs/iconTimeout.gif" width="24" height="24" alt="" /></td>'+
					  '</tr>'+
					  '<tr>'+
						'<td colspan="2" style="text-align:right;">دريافت اطلاعات با مشکل مواجه شد. لطفاً بعد از بررسی ارتباط خود با اينترنت دوباره سعی کنيد</td>'+
					  '</tr>'+
					'</table>'+
					'</div>'+
					'<div class="BoxFooter""><div></div></div>'+
				'</div>';
			this.miniHtml = 	'<div style="width:100%;height:23px;background:url(include/bannerchanger/imgs/xwindows.gif) repeat-x 0px -495px;border:1px solid #969696;">'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnCloseMini" width="19" height="19" alt="" title="بستن پنجره" style="margin:2px 4px 2px 2px; float:right" />'+
									'<img src="imgs/blank.gif" id="'+this.winName+'BtnMaximizeMini" width="19" height="19" alt="" title="بزرگ کردن پنجره" style="margin:2px; float:right;" />'+
									'<div id="'+this.winName+'miniTitle" style="width:140px;float:left;padding:2px 0 0 10px;"></div>'+
								'</div>';
			this.winHolder = "xpopupHolder" + this.winName;
			this.winWidth = (typeof(width) == "undefined")?200:width;
			this.winPage = '';
			this.winCmd = '';
			this.winDirectUrl = '';
			this.onClose = '';
			this.onOpen = '';
			this.onMinimize = '';
			this.onMaximize = '';
			this.imageUrl = 'imgs/xwindows.gif';
			this.imgObj = null;
		},
	create:		function(){
			var Obj = document.createElement('div');
			Obj.id = this.winHolder;
			Obj.style.width = "750px";
			Obj.style.position = "absolute";
			Obj.style.top = "100px";
			Obj.style.left = "100px";
			document.getElementsByTagName('body')[0].appendChild(Obj);
			Obj.innerHTML =	this.winHtml;	
			this.winStatus = 'created';
			this.imgObj = new xBtn(this.imageUrl);
			this.loadbtn(1);

		},
	loadbtn:	function(whiche){
			switch(whiche){
				case 1:
					this.imgObj.create(this.winName+'BtnClose', 0, 1, this.winObj+'.hide(this);');
					this.imgObj.create(this.winName+'BtnMinimize', 114, 1, this.winObj+'.minimize(this);');
					this.imgObj.create(this.winName+'BtnReload', 171, 1, this.winObj+'.reload(this);');
					break;
				case 2:
					this.imgObj.create(this.winName+'BtnCloseMini', 0, 1, this.winObj+'.hide(this);');
					this.imgObj.create(this.winName+'BtnMaximizeMini', 57, 1, this.winObj+'.maximize(this);');
					break;
			}
		},
	show:		function(page, cmd){
			if(this.winStatus == 'none')
				this.create();
			this.maximize();
			$(this.winHolder).style.width = (this.winWidth*1+50) +"px";
			this.winPage = page;
			this.winCmd = cmd;
			if(this.winLastPage != page+"#"+cmd)
			{
				this.loading();
				this.fetch();
			}
			this.winLastPage = page+"#"+cmd;
			var sw = document.getElementsByTagName("body")[0].clientWidth || screen.width;
			var sl = Math.round((sw - this.winWidth )/2);
			st = 90+document.documentElement.scrollTop-0;
			$(this.winHolder).style.top = st + 'px';
			$(this.winHolder).style.left = sl + 'px';
			xMakeVisible(this.winHolder);
			this.winStatus = 'visible';
			$(this.winName+'Title').innerHTML = this.winCaption;
			
			var cmd = this.onOpen.split(';');
			for(key in cmd)
			try{
				eval(cmd[key]);
			}catch(e){}
		},
	hide:		function(){
			if(this.winStatus == 'none')
				return;
			xMakeHidden(this.winHolder);
			try{
				xMakeHidden(this.winName+'mini');
			}catch(e){}
			this.winStatus = 'hidden';
			
			var cmd = this.onClose.split(';');
			for(key in cmd)
			try{
				eval(cmd[key]);
			}catch(e){}
		},
	loading:	function(){
		$(this.winName+"Container").innerHTML =	this.loadingHtml;
		},
	fetch:		function(){
		this.winDirectUrl = '';
		this.checkdirect();
		this.status("درحال بارگذاری...");
		getContent(
					this.winMainPage,
						'section=guest&module='+this.winPage+'&'+this.winCmd,
							'$("'+this.winName+'Container").innerHTML = Contents;'+
							this.winObj+'.status("انجام شد");'+
							this.winObj+'.checkdirect();',
								this.winObj+'.error();',
									'GET'
				);
		},
	reload:		function(){
		this.loading();
		this.fetch(this.winPage, this.winCmd);
		},
	status:		function(text){
		$(this.winName+"Status").innerHTML = "<div style='direction:rtl'>&nbsp;&nbsp;&nbsp;" + text + "&nbsp;&nbsp;&nbsp;</div>";
		},
	maximize:	function(){
		var cmd = this.onMaximize.split(';');
		for(key in cmd)
			try{
				eval(cmd[key]);
			}catch(e){}
		var sw = document.getElementsByTagName("body")[0].clientWidth || screen.width;
		var sl = Math.round((sw - this.winWidth )/2);
		st = 90+document.documentElement.scrollTop-0;
		$(this.winHolder).style.top = st + 'px';
		$(this.winHolder).style.left = sl + 'px';
		if($('fixBox')){
			try{
				xMakeHidden(this.winName+'mini');
			}catch(e){}
			xMakeVisible(this.winHolder);	
		}else{
			xMakeVisible(this.winName+'MainTable');
			this.imgObj.create(this.winName+'BtnMinimize', 114, 1, this.winObj+'.minimize();');
			}
		this.winStatus = 'visible';
		},
	minimize:	function(){
		if(this.winStatus != 'visible')
			return;
		if($('fixBox')){
			xMakeHidden(this.winHolder);
			this.makemini();
			xMakeVisible(this.winName+'mini');
		}else{
			xMakeHidden(this.winName+'MainTable');
			this.imgObj.create(this.winName+'BtnMinimize', 57, 1, this.winObj+'.maximize();');
			}
		this.winStatus = 'minimize';
		var cmd = this.onMinimize.split(';');
		for(key in cmd)
		try{
			eval(cmd[key]);
		}catch(e){}
		},
	makemini:	function(){
		if(!$(this.winName+'mini')){
			var Obj = document.createElement('div');
			Obj.id = this.winName+'mini';
			Obj.style.width = "200px";
			Obj.style.margin = "0px 2px";
			Obj.style.cssFloat = "left";
			$('fixBox').appendChild(Obj);
			Obj.innerHTML =	this.miniHtml;
			this.loadbtn(2);
			}
		$(this.winName+'miniTitle').innerHTML = this.winCaption;
		},
	checkdirect:function(){
		if(this.winDirectUrl.length <= 1){
			this.imgObj.show(this.winName+'BtnNewOpen', 285, 0);
	  	}else{
			this.imgObj.create(this.winName+'BtnNewOpen', 228, 1, this.winObj+'.opennewwin();');
			}
		},
	error:		function(){
		this.status("اشکال در دريافت اطلاعات!");
		$(this.winName+"Container").innerHTML =	this.errorHtml;
	},
	opennewwin:	function(){
		if(this.winDirectUrl != ''){
			window.open(this.winDirectUrl, '_blank');
			}else{
			xHint($(this.winName+'BtnNewOpen'), 'متأسفانه لينک مستقيم به اين قسمت وجود ندارد\nلطفاً پس از تکميل بارگذاری دوباره سعی نمائيد', 'لينک مستفيم', 'error', 270, 'rtl', 5);
			}
		}
	});
//---------------------------------------------------------------------------------
var xpopupBox = new Class({
	initialize: function(name, Obj, width, parent){
		this.boxMainPage = '../global/index.php';
		this.boxName = name;
		this.boxObj = Obj;
		this.boxHolder = "popupBoxHolder"+name;
		this.boxWidth = (width+62)||350;
		this.boxHtml = 		'<table border="0" cellpadding="0" cellspacing="0" width="'+this.boxWidth+'">'+
							  '<tr>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -305px; width:15px; height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -320px; width:15px; height:15px"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat"></td>'+
								'<td style="background:#DADADA; padding:5px;">'+
									'<div class="whiteBoxHolder" style="text-align:left; padding:0;width:100%;">'+
										'<div class="BoxHeader"><div></div></div>'+
										'<div class="BoxContent" style="padding:0px 4px 4px;text-align:right;">'+
											'<img src="imgs/blank.gif" id="'+this.boxName+'BtnClose" width="18" height="18" alt="" border="0" />'+
										'</div>'+
										'<div class="BoxLine"></div>'+
										'<div class="BoxContent" style="padding:0;" id="'+this.boxName+'Cont">'+
										'</div>'+
										'<div class="BoxFooter"><div></div></div>'+
									'</div>'+
								'</td>'+
								'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat;"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -335px; width:15px; height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -350px; width:15px; height:15px"></td>'+
							  '</tr>'+
						'</table>';	
		this.loadingHtml =	'<table border="0" cellpadding="0" cellspacing="0" width="100px" style="margin:0 auto">'+
							  '<tr>'+
								'<td colspan="2" height="50"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td>لطفاً صبر کنيد</td>'+
								'<td><img src="imgs/loading.gif" width="16" height="16" alt="" /></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td colspan="2" height="50"></td>'+
							  '</tr>'+
							'</table>';                             
		this.boxParent = (typeof(parent)=="object")?parent:$(parent);
		this.boxPage = '';
		this.boxCmd = '';
		this.boxStatus = 'none';
		this.imgObj = null;
		this.imageUrl = 'imgs/xwindows.gif';
		this.onClose = '';
		},
	create:		function(){
		var Obj = document.createElement('div');
		Obj.id = this.boxHolder;
		Obj.style.position = 'absolute';
		document.getElementsByTagName('body')[0].appendChild(Obj);
		$(this.boxHolder).innerHTML = this.boxHtml;
		this.boxStatus = 'created';
		this.imgObj = new xBtn(this.imageUrl);
		this.imgObj.create(this.boxName+'BtnClose', 390, 1, this.boxObj+'.hide(this);');
		},
	show:		function(page, cmd, obj){
		if(typeof(page) != "undefined")
			this.boxPage = page;
		if(typeof(cmd) != "undefined")
			this.boxCmd = cmd;
		if(typeof(obj) != "undefined")
			this.boxParent = (typeof(obj) == "object")?obj:$(obj);
		if(this.boxStatus == 'none')
			this.create();
		$(this.boxHolder).style.zIndex = 11;
		$(this.boxHolder).style.width = this.boxWidth+"px";
		this.loading();
		this.fetch(page);
		var sw = document.getElementsByTagName("body")[0].clientWidth || screen.width;
		var sl = Math.round((sw - this.boxWidth )/2);
		sl = (xFindPosX(this.boxParent)+10)||sl;
		if((sl*1 + this.boxWidth*1)> sw)
			sl = sw - this.boxWidth - 50;
		st = 50+document.documentElement.scrollTop-0;
		$(this.boxHolder).style.top = (xFindPosY(this.boxParent)+5||st) + 'px';
		$(this.boxHolder).style.left = sl + 'px';
		xMakeVisible(this.boxHolder);
		this.boxStatus = 'visible';
		},
	hide:		function(){
		if(this.boxStatus == 'none')
			return;
		xMakeHidden(this.boxHolder);
		this.boxStatus = 'hidden';
		try{
			eval(this.onClose);
		}catch(e){}
		},
	loading:	function(){
		$(this.boxName+"Cont").innerHTML =	this.loadingHtml;
		},
	fetch:		function(){
		getContent(this.boxMainPage,
						'section=guest&module='+this.boxPage+'&'+this.boxCmd+'&'+Math.round(),
							'$("'+this.boxName+'Cont").innerHTML = Contents;',
								'',
									'GET'
					);
		}
	});
//---------------------------------------------------------------------------------
var xpopupImg = new Class({
	initialize: function(name, Obj, width, parent){
		this.boxName = name;
		this.boxObj = Obj;
		this.boxHolder = "popupBoxHolder"+name;
		this.boxWidth = (width||550) + 62;
		this.boxHtml = 		'<table border="0" cellpadding="0" cellspacing="0" width="100%">'+
							  '<tr>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -305px; width:15px; height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -320px; width:15px; height:15px"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat"></td>'+
								'<td style="background:#DADADA; padding:5px;">'+
									'<div class="whiteBoxHolder" style="text-align:left; padding:0;width:100%;">'+
										'<div class="BoxHeader"><div></div></div>'+
										'<div class="BoxContent" style="padding:0px 4px 4px;text-align:right;">'+
											'<img src="imgs/blank.gif" id="'+this.boxName+'BtnClose" width="18" height="18" alt="" border="0" />'+
										'</div>'+
										'<div class="BoxLine"></div>'+
										'<div class="BoxContent" style="padding:5px 11px;" id="'+this.boxName+'Cont">'+
										'</div>'+
										'<div class="BoxFooter"><div></div></div>'+
									'</div>'+
								'</td>'+
								'<td style="width:15px;background:url(include/bannerchanger/imgs/xwindowsBG.gif) repeat"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -335px; width:15px; height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) repeat 0px -365px ;height:15px"></td>'+
								'<td style="background:url(include/bannerchanger/imgs/xwindows.gif) left -350px; width:15px; height:15px"></td>'+
							  '</tr>'+
						'</table>';	
		this.loadingHtml =	'<table border="0" cellpadding="0" cellspacing="0" width="100px" style="margin:0 auto">'+
							  '<tr>'+
								'<td colspan="2" height="50"></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td>لطفاً صبر کنيد</td>'+
								'<td><img src="imgs/loading.gif" width="16" height="16" alt="" /></td>'+
							  '</tr>'+
							  '<tr>'+
								'<td colspan="2" height="50"></td>'+
							  '</tr>'+
							'</table>';                             
		this.boxParent = (typeof(parent)=="object")?parent:$(parent);
		this.bottomUrl = '';
		this.boxStatus = 'none';
		this.imgObj = null;
		this.imageUrl = 'imgs/xwindows.gif';
		this.imgLoad = '';
		},
	create:		function(){
		var Obj = document.createElement('div');
		Obj.id = this.boxHolder;
		Obj.style.position = 'absolute';
		document.getElementsByTagName('body')[0].appendChild(Obj);
		$(this.boxHolder).innerHTML = this.boxHtml;
		this.boxStatus = 'created';
		this.imgObj = new xBtn(this.imageUrl);
		this.imgObj.create(this.boxName+'BtnClose', 390, 1, this.boxObj+'.hide(this);');
		},
	show:		function(){
		if(this.boxStatus == 'none')
			this.create();
		$(this.boxHolder).style.zIndex = 11;
		$(this.boxHolder).style.width = this.boxWidth+"px";
		var sw = document.getElementsByTagName("body")[0].clientWidth || screen.width;
		var sl = Math.round((sw - this.boxWidth )/2);
		st = 50+document.documentElement.scrollTop-0;
		$(this.boxHolder).style.top = (xFindPosY(this.boxParent)+5||st) + 'px';
		//$(this.boxHolder).style.left = (xFindPosX(this.boxParent)+10||sl) + 'px';
		$(this.boxHolder).style.left = sl + 'px';
		xMakeVisible(this.boxHolder);
		this.boxStatus = 'visible';
		},
	hide:		function(){
		if(this.boxStatus == 'none')
			return;
		xMakeHidden(this.boxHolder);
		this.boxStatus = 'hidden';
		},
	loading:	function(){
		$(this.boxName+"ImgBotHtml").innerHTML =	this.loadingHtml;
		},
	fetch:		function(){
		getContent(this.bottomUrl,
						'&'+Math.round(),
							'$("'+this.boxName+'ImgBotHtml").innerHTML = Contents;',
								'',
									'GET'
					);
		},
	enlarge:	function(xobj, ximg, xwidth, xbottomUrl, needNavigate){
		if(typeof(needNavigate) == "undefined")
			needNavigate = false;
		if(typeof(xwidth) != "undefined")
			this.boxWidth = xwidth*1+62;
		this.boxParent = (typeof(xobj) != "object")?$(xobj):xobj;
		var imgSrc = ximg;
		if(this.boxStatus != 'visible')
			this.show();
		var img = ximg;
		var IMGloading = (this.imgLoad == '' || !needNavigate)?'':'onload="try{'+this.imgLoad+'}catch(e){}"';
		$(this.boxName + "Cont").innerHTML =
			'<center class="loading">'+
				'<img border="0" id="'+this.boxName+'MainPic" src="'+imgSrc+'" alt="" border"0" usemap="#'+this.boxName+'Map" '+IMGloading+' />'+
				'<div id="'+this.boxName+'PicBot">'+
					'<map name="'+this.boxName+'Map"  id="'+this.boxName+'Map">'+
						'<area shape="rect" coords="0,0,0,0" href="#1" />'+
						'<area shape="rect" coords="0,0,0,0" href="#2" />'+
					'</map><br /><br /></div>'+
				'<div id="'+this.boxName+'ImgBotHtml"></div>'+
			'</center>';
		if(typeof(xbottomUrl) != "undefined"){
			this.bottomUrl = xbottomUrl;
			this.loading();
			this.fetch();
			}
		}
	});
//---------------------------------------------------------------------------------
var xcomboBox =	new Class({
	initialize: function(name, selObj, Obj, width){
		this.comboObj = Obj;
		this.comboName = name;
		this.comboWidth = width||200;
		this.comboHeight = 23;
		this.comboSelObj = (typeof(selObj) != "object")?$(selObj):selObj;
		this.comboListHeight = '200';
		this.comboStatus = 'none';
		this.comboOnchange = '';
		this.listValue = Array();
		this.listText = Array();
		this.listSelect = Array();
		this.comboBgImage = '';
		this.comboListBgColor = this.comboListBgColor||'#FFFFFF';
		this.comboBgColor = this.comboBgColor||'transparent ';
		this.comboStyle = this.comboStyle||';text-align:right;';
		this.comboItemClass = 'xComboBox';
		this.comboBtn = '';
		this.lastSelected = '';
		this.readOnly = ' readonly="readonly"';
		this.changeOnCreate = true;
		},
	create:		function(){
		if(this.comboStatus != 'none')
			return;
		this.fetch();
		var HTML11 ='<div style="padding:0;margin:0;background:'+this.comboBgColor+' url('+this.comboBgImage+') no-repeat scroll left; height:'+this.comboHeight+'px;width:'+this.comboWidth+'px" onclick="'+this.comboObj+'.togle();">'+
						'<input '+this.readOnly+' type="text" name="'+this.comboName+'Cap" id="'+this.comboName+'Cap" value="" style="font-family:Tahoma, Verdana, arial;font-size:12px;padding:0 2px 0 0;border:0; margin:2px 0;width:'+(this.comboWidth-2)+'px;background:'+this.comboBgColor+' url('+this.comboBgImage+') no-repeat scroll left;'+this.comboStyle+'" />'+
						'<input type="hidden" name="'+this.comboName+'" id="'+this.comboName+'" />'+
					'</div>';
		var HTML2 = '<div id="'+this.comboName+'ListCont" style="position:relative;"><div style=" background:'+this.comboListBgColor+'; border:1px solid #AAAAAA;padding:3px;width:'+this.comboWidth+'px;display:none;overflow:visible;position:absolute;left:-3px" id="'+this.comboName+'List"></div></div>';
		this.comboSelObj.parentNode.innerHTML = HTML11 + HTML2;

		var itemList = '';
		for(k in this.listText){
			if(typeof(this.listText[k]) == 'function' || typeof(this.listText[k]) == 'object')
				continue;
			if(this.listSelect[k]){
				this.select(k);
				}
			itemList = itemList + "<a href=\"javascript:"+this.comboObj+".select("+k+");\" class='"+this.comboItemClass+"'>"+this.listText[k]+"</a>";
			}
		$(this.comboName+'List').innerHTML = itemList;
		this.comboStatus = 'close';
		if(this.comboBtn){
			if(typeof(this.comboBtn) != 'object')
				this.comboBtn = $(this.comboBtn);
			var CMD = this.comboObj+'.togle();';
			this.comboBtn.style.cursor = 'pointer';
			this.comboBtn.onclick = function(){	eval(CMD); };
			}
		},
	fetch:		function(){
		try{
		if(this.comboSelObj.style.height)
			this.comboListHeight = this.comboSelObj.style.height.toUpperCase().split("PX")[0] || this.comboListHeight;
		}catch(e){}
		for(var i=0; i<this.comboSelObj.length; i++){
			this.listValue.push(this.comboSelObj[i].value||'0');
			this.listText.push(this.comboSelObj[i].text||'&nbsp;');
			this.listSelect.push(this.comboSelObj[i].selected);
			}
		},
	select:		function(k){
			$(this.comboName+'Cap').value = (this.listText[k] == '&nbsp;')?' ':this.listText[k];
			$(this.comboName).value = this.listValue[k]||this.listText[k];
			if(this.lastSelected != $(this.comboName).value){
				this.lastSelected = $(this.comboName).value;
				try{
					if(this.changeOnCreate || this.comboStatus != 'none')
						eval(this.comboOnchange);
				}catch(e){}
				}

		},
	open:		function(){
		if(this.comboStatus == 'open')
			return;
		xMakeVisible(this.comboName+"List");
		if($(this.comboName+"List").style.overflow == "visible"){
			$(this.comboName+"List").style.overflow = "auto";
			if($(this.comboName+"List").clientHeight > 200){
				$(this.comboName+"List").style.height = this.comboListHeight+"px";
				if(browser != "msie")
					$(this.comboName+"List").style.width = ($(this.comboName+"List").clientWidth*1+28) +"px";
				else
					$(this.comboName+"List").style.width = ($(this.comboName+"List").clientWidth*1+10) +"px";
			}
		}
		this.comboStatus = 'open';
		setTimeout('document.getElementsByTagName("body")[0].onclick = function(){'+this.comboObj+'.close();};', 100);
		},
	close:		function(){
		xMakeHidden(this.comboName+"List");
		document.getElementsByTagName("body")[0].onclick = function(){
															};
		this.comboStatus = 'close';
		},
	togle:		function(){
		if(this.comboStatus == 'open')
			this.close();
		else
			this.open();
		}
	});
//---------------------------------------------------------------------------------
var xpagingBtn=	new Class({
	initialize: function(name, parent, OBJ){
			this.obj = OBJ;
			this.parent = (typeof(parent) == 'object')?parent:$(parent);
			this.name = name;
			this.curPos = 1;
			this.lastPos = 1;
			this.maxPos = 1;
			this.loopNumber = 0;
			this.isSpeedIncresed = false;
			this.width = 220;
			this.timeInterval = 1500;
			this.islock = false;
			this.preClass = 'preBtn';
			this.nextClass = 'nextBtn';
			this.dotClass = 'dotBtn';
			this.btnHtml = '';
			this.onchange = '';
		},
	updateHtml:	function(){
			this.btnHtml = '';
			for(i=this.maxPos;i>0;i--)
				this.btnHtml += '<a id="'+this.name+'_dot'+i+'" class="'+this.dotClass+'" href="javascript:'+this.obj+'.go('+i+')" title="اسلاید '+i+'" >&nbsp;</a>';
			this.btnHtml = 	'<a id="'+this.name+'_next" class="'+this.nextClass+'Dis" href="javascript:'+this.obj+'.next()"  title="اسلاید قبل" >&nbsp;</a>'+
							this.btnHtml+
							'<a id="'+this.name+'_pre" class="'+this.preClass+'Dis" href="javascript:'+this.obj+'.pre()"  title="اسلاید بعد" >&nbsp;</a>';
			return this.btnHtml;
		},
	create:		function(){
			this.parent.innerHTML = this.updateHtml();
			this.update();
		},
	update:		function(){
			for(i=1;i<=this.maxPos;i++)
				$(this.name+'_dot'+i).className = this.dotClass;
			$(this.name+'_dot'+this.curPos).className = this.dotClass+'On';
			if(this.curPos > 1)
				$(this.name+'_pre').className = this.preClass;
			else
				$(this.name+'_pre').className = this.preClass + 'Dis';
			if(this.curPos < this.maxPos)
				$(this.name+'_next').className = this.nextClass;
			else
				$(this.name+'_next').className = this.nextClass + 'Dis';
		},
	go:			function(where){
			if(this.islock)
				return;
			if(where!= this.curPos && where>0 && where<=this.maxPos){
				this.lastPos = this.curPos;
				this.curPos = where;
				this.update();
				try{
					eval(this.onchange);
				}catch(e){}
			}
		},
	next:		function(xforce){
			var force = (typeof(xforce) == "undefined")?false:xforce;
			if(this.curPos<this.maxPos)
				this.go(this.curPos*1+1);
			else
				if(force)
					this.go(1);
		},
	pre:		function(xforce){
			var force = (typeof(xforce) == "undefined")?false:xforce;
			if(this.curPos>1)
			this.go(this.curPos*1-1);
			else
				if(force)
					this.go(this.maxPos);
		},
	lock:		function(){
			this.islock = true;
		},
	unlock:		function(){
			this.islock = false;
		}	
	});
//---------------------------------------------------------------------------------
var xBtn	  =	new Class({
	initialize: function(img){
		this.img = img;
		this.blankImg = "imgs/blank.gif";
	},
	create:		function(xobj, xtopPos, xhaveDown, xcmd){
		var topPos = (typeof(xtopPos) == "undefined")?0:xtopPos;
		var haveDown = (typeof(xhaveDown) == "undefined")?true:xhaveDown;
		var obj = (typeof(xobj) != "object")?$(xobj):xobj;
		var width = obj.clientWidth || obj.width || 50;
		var height = obj.clientHeight || obj.height || 22;
		var normal = "transparent url("+this.img+") no-repeat 0px -"+ topPos +"px";
		var over = "transparent url("+this.img+") no-repeat 0px -"+ (topPos*1+height*1) +"px";
		var down = over;
		if(haveDown)
			down = "transparent url("+this.img+") no-repeat 0px -"+ (topPos*1+height*2) +"px";
		var cmd = (typeof(xcmd) == "undefined")?'':xcmd;
		this.makebtn(obj, normal, over, down, cmd);
	},
	show:		function(xobj, xtopPos){
		var topPos = (typeof(xtopPos) == "undefined")?0:xtopPos;
		var obj = (typeof(xobj) != "object")?$(xobj):xobj;
		var normal = "transparent url("+this.img+") no-repeat 0px -"+ topPos +"px";
		this.makeimg(obj, normal);
	},
	makebtn:	function(obj, normal, over, down, cmd){
		obj.onmouseover	= function(){
			obj.style.background = over;
			};

		obj.onmouseout	= function(){
			obj.style.background = normal;
			};

		obj.onmouseup 	= function(){
			obj.style.background = over;
			};

		obj.onmousedown = function(){
			obj.style.background = down;
			};

		if(typeof(cmd) != "undefined")
			obj.onclick		= function(){
				try{
					eval(cmd);
					}catch(e){}
				};		

		obj.onload		= function(){;
			};

			obj.ondblclick	= function(){
			};
			
		obj.src = this.blankImg;
		obj.style.background = normal;
		obj.style.cursor = "pointer";
	},
	makeimg:	function(obj, normal){
		obj.onmouseover	= function(){
			};
		obj.onmouseout	= function(){
			};
		obj.onmouseup 	= function(){
			};
		obj.onmousedown = function(){
			};
		obj.onclick		= function(){
			};
		obj.onload		= function(){
			};
		obj.ondblclick	= function(){
			};
		
		obj.src = this.blankImg;
		obj.style.background = normal;
		obj.style.cursor = "auto";
	}});
//---------------------------------------------------------------------------------



 
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;;﻿/*
	Name: Site Function
	Ver. 1.05
	Create Date: 1386/05/09
	Last Update: 1386/10/22
*/
var runAtHtmlLoad	= Array();
var runAtPageLoad	= Array();
var runAtScriptLoad	= Array();
function loadTrigger(where)								
{
	switch(where){
		case 'html':
			while(runAtHtmlLoad.length > 0)
				try{
					eval(runAtHtmlLoad.pop());
				} catch(e){alert(e);}
			break;
		case 'page':
			while(runAtPageLoad.length > 0)
				try{
					eval(runAtPageLoad.pop());
				} catch(e){alert(e);}
			break;
		case 'javascript':
			while(runAtScriptLoad.length > 0)
				try{
					eval(runAtScriptLoad.pop());
				} catch(e){alert(e);}
			break;
		}
}
function changeMainNesw(where)							
{
	mainNewsPg.loopNumber++;
	if ((!mainNewsPg.isSpeedIncresed) && (mainNewsPg.loopNumber >= mainNewsPg.maxPos))
		{
		mainNewsPg.timeInterval = mainNewsPg.timeInterval * 2;	
		mainNewsPg.isSpeedIncresed = true;
		}
	if( where <= mainNewsPg.maxPos && where >= 1 ){
		mainNewsPg.lock();
		$("mainNeswProgress").style.background = "url(include/bannerchanger/imgs/progressO.gif) no-repeat 0px -26px";
	}

	moveIt('mainNewsContainer', 'style.left', ((where - 1) - (where - mainNewsPg.lastPos)) * mainNewsPg.width , mainNewsPg.width * (where-1) - (2*where) , 'mainNewsPg.unlock();');
}
function autochangeMainNews()							
{
	if(!autochangeNewsRun){
		setTimeout("autochangeMainNews()", 1000);
		return;
	}
	var id = xGetInt($("mainNeswProgress").style.background.substr($("mainNeswProgress").style.background.indexOf("px")))/13;
	var newid = (id>=14)?2:id*1+1;
	if (newid == 2){
		mainNewsPg.next(true);
	}
	//url(include/bannerchanger/imgs/progressO.gif) no-repeat 0px -26px
	$("mainNeswProgress").style.background = "url(include/bannerchanger/imgs/progressO.gif) no-repeat 0px -"+newid*13+"px";
	setTimeout("autochangeMainNews()", mainNewsPg.timeInterval);
}
var autochangeNewsRun = true;
function autochangeNewsPP()								
{
	if(autochangeNewsRun){
		autochangeNewsRun = false;
		$("autochangeNewsPPBtn").style.background = "url(include/bannerchanger/imgs/progressO.gif) no-repeat 0px -13px";
		$("autochangeNewsPPBtn").title = "حرکت";
	}else{
		autochangeNewsRun = true;
		$("autochangeNewsPPBtn").style.background = "url(include/bannerchanger/imgs/progressO.gif) no-repeat 0px 0px";
		$("autochangeNewsPPBtn").title = "توقف";
	}
}
function changeNeswTextSite(where)						
{
	switch(where){
		case 1:
			$("newsDetailBody").style.fontSize = "12px";
			$("newsDetailBody").style.lineHeight = "20px";
			$("relatedNewsBox").style.fontSize = "11px";
			$("relatedNewsBox").style.lineHeight = "18px";
			break;
		case 2:
			$("newsDetailBody").style.fontSize = "16px";
			$("newsDetailBody").style.lineHeight = "24px";
			$("relatedNewsBox").style.fontSize = "16px";
			$("relatedNewsBox").style.lineHeight = "24px";
			break;
		}
}
	
try{loadTrigger('javascript');}catch(e){}
