﻿/*-----------------کد ای جکس دریافت داده ها-----------------*/

var index00=""
var http_request = false;
function makeRequest(url,index2)
{
	document.all['loading'].style.display=''
	index00=index2;
	http_request = false;
	if (window.XMLHttpRequest){ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	}
	else if (window.ActiveXObject){ // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {}
		}
	}

	if (!http_request){
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	http_request.onreadystatechange = alertContents;
	roun=Math.round(Math.random()*10000000)
	http_request.open('GET', (url+'?'+roun), true);
	http_request.send(null);
}
function alertContents()
{
	if (http_request.readyState == 4){
		if (http_request.status == 200){
			document.all['loading'].style.display='none'
			index00.innerHTML=http_request.responseText;
			}
		else alert('There was a problem with the request.');
	}
}
/*---------------------------پايان تابع------------------------*/


/*-------------------------تابع مديريت لايه ها----------------------------*/
var oldind="LN"
function tab(Tindex,num)
{
	if(num==0){
	document.all[oldind].style.display="none"
	document.all["home"].style.display="none"
	document.all[Tindex].style.display=""
	}
	else if(num==1){
	document.all[oldind].style.display="none"
	document.all['L_Feedback'].style.display=""
	document.all["home"].style.display=""
	document.all["tazeha"].style.display="none"
	document.all[Tindex].style.display=""
	}
	else if(num==2){
	document.all[oldind].style.display="none"
	document.all["home"].style.display=""
	document.all["tazeha"].style.display=""
	document.all[Tindex].style.display=""
	under.innerHTML=''
	}
	else if(num==3){
	document.all[oldind].style.display="none"
	document.all["home"].style.display=""
	document.all["tazeha"].style.display="none"
	document.all[Tindex].style.display=""
	}
	else{
	return false
	}
	oldind=Tindex
}
/*--------------پايان تابع ---------------------------*/
/*------------------ تابع نمايش منو بالاي صفحه--------------------*/
var oldLayer = ""
var Timer
var OldTdN
function funHide()
{
	 if(oldLayer)document.all[oldLayer].style.display="none"
}
function funDelay()
{
		 Timer = setTimeout("funHide()",500);
}

function funClearTime()
{
		 clearTimeout(Timer);
}	 
function funfilter(DivID,TdN){
	if(oldLayer&&DivID!=oldLayer)
	document.all[oldLayer].style.display="none";
	if(DivID){
	document.all[DivID].style.display="";
	}
	oldLayer=DivID;
	OldTdN=TdN;
}
/*------------------پايان تابع------------------*/
/*--------------توابع نمايش عكس بزرگ و امكاناتش--------------*/
var IdImg
ic=0
child='child'+ic
/*-------در اين متغير تعداد عكسهاي موجود در صفحه را قراردهيد---------------*/
var imgLength=8
/*-------------------------------------*/
ImgSrc=new Array(imgLength)

/*-----در اين متغير مشخصات هر عكس قرار مي‌گيرد------*/
pro=new Array(imgLength)
pro[0]="عكس يك"
pro[1]="عكس دو"
pro[2]="عكس سه"
pro[3]="عكس چهار"
pro[4]="عكس پنج"
pro[5]="عكس شش"
pro[6]="عكس هفت"
pro[7]="عكس هشت"
pro[8]="عكس نه"

/*------------------------*/
function openImg()
{
		i=0
	do
	{
		a='imgs'+i
		a=eval(a)
		ImgSrc[i]=a.src
		i+=1
	}
	while(i<imgLength+1)
	OLImg()
}

function OLImg()
{
child='child'+ic
imgR=ImgSrc[IdImg].replace("proje1","proje2")
var Layer='<div style="position: absolute; width:200; height:1; z-index:100; right: 150px; top: 50px;" id="'+child+'">\r\n\
	<table border="0" cellspacing="0" cellpadding="0" style="border: 5px ridge #8F8F8F">\n\r\
		<tr>\n\r\
			<td height="22" bgcolor="#EFEFEF" style="border-bottom:3px ridge #8F8F8F;"><p align="Right">'+pro[IdImg]+'</td>\n\r\
			<td height="22" width="90" bgcolor="#EFEFEF" style="border-bottom:3px ridge #8F8F8F;" align="left">\n\r\
			<img border="0" src="../images/arrow_right.gif" onclick="nextImg()" title="بعدي" width="20" height="20">\n\r\
		<img border="0" src="../images/arrow_left.gif" onclick="prevImg()" title="قبلي" width="20" height="20">	</td>\n\r\
			<td height="22" width="20" bgcolor="#EFEFEF" style="border-bottom:3px ridge #8F8F8F;" align="left">\n\r\
			<img border="0" src="../images/close.gif" title="بستن پنجره" width="20" height="21" align="left" onclick="showI.innerHTML=\'\'"></td>\n\r\
		</tr>\n\r\
		<tr>\n\r\
			<td colspan="6" bgcolor="#FFFFFF" style="border-bottom:1px solid #000000;"><img id="Pimg" border="0" src="../fa/'+imgR+'" onload="WHImg()"></td>\n\r\
		</tr>\n\r\
	</table>\n\r\
</div>'
ic+=1
showI.innerHTML=Layer
}

function nextImg()
{
	if(IdImg<imgLength){
	IdImg+=1
	OLImg()
	}
	else return false
}
function prevImg()
{
	if(IdImg>0){
	IdImg-=1
	OLImg()
	}
	else return
}

/*---------------------------پايان توابع --------------------*/
/*-------------تابع نمايش مشخصات در قسمت نوع مشاركت---------*/
/*-------------پايان تابعغ------------*/

/*-------------------تابع زوم نقشه--------------------*/
var tim1
var tim2
var iMaps=100
var LL
var LT
function zoom_map(){
if(tim2)stop_zoom_map()
LL=maps.document.all['moveMe'].style.pixelLeft;
LT=maps.document.all['moveMe'].style.pixelTop;
if(iMaps<400){
	iMaps+=5
	LL-=25
	LT-=25
	maps.document.all['moveMe'].style.left=LL;
	maps.document.all['moveMe'].style.top=LT;
	}
maps.img_map.style.zoom=(iMaps+"%");
tim1=setTimeout('zoom_map()',10)
}

function zoom_ute_map(){
if(tim1)stop_zoom_map()
if(iMaps>100){
	iMaps-=5
	LL+=25
	LT+=25
	maps.document.all['moveMe'].style.left=LL;
	maps.document.all['moveMe'].style.top=LT;
	}
maps.img_map.style.zoom=(iMaps+"%");
tim2=setTimeout('zoom_ute_map()',10)
if(iMaps<=100){
stop_zoom_map()
}
}

function stop_zoom_map(){
if(tim1)window.clearTimeout(tim1)
if(tim2)window.clearTimeout(tim2)
}
function MapDefault()
{
	maps.Rimg()
	zoom_ute_map()
}
function Rimg()
{
	W=img_map.width
	L=(W/2)-200
	H=img_map.height;
	T=(H/2)-175;
	document.all['moveMe'].style.left=L*-1;
	document.all['moveMe'].style.top=T*-1;
}
/*---------------------------------*/
/*---------------حركت نقشه-------------*/
mouseover = true
function coordinates()
{
    if (!moveMe)
    {
        return
    }
        mouseover = true
        pleft = moveMe.style.pixelLeft
        ptop = moveMe.style.pixelTop
        xcoor = event.clientX
        ycoor = event.clientY
        document.onmousemove = funmove
}
function funmove()
{
    if (mouseover && event.button == 1)
    {
        moveMe.style.pixelLeft = pleft+event.clientX-xcoor
        moveMe.style.pixelTop = ptop+event.clientY-ycoor
        return false
    }
}
function mouseup()
{
    mouseover = false
}
/*------------پايان تابع-----------*/
function playfilm(srcFilm)
{
window.open(srcFilm,'','width=400,height=330,left=200,top=150')
}

function set_link(url){
document.getElementById("main").src=url;
}
function search_link(url){
req=document.getElementById("q").value;
document.getElementById("main").src=url+'?q='+req;
}
function view_image(pic_url,pic_des){
document.getElementById('view').style.display='';
document.getElementById('img_large').src=pic_url;
document.getElementById('pic_description').innerHTML=pic_des;

}
function WHImg()
{
	var WI=img_large.width
	var HI=img_large.height
	var Ri=((screen.width/2)-(WI/2))-50
	document.all['view'].style.width=WI
	document.all['view'].style.height=HI
	document.all['view'].style.right=Ri
}
function close_win(){
document.getElementById('view').style.display='none';
document.getElementById('img_large').src='';
document.getElementById('pic_description').innerHTML='';

}
    function req(url,lang) {
        var rnd = Math.random();
		
        var http_request = false;

        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) {
           
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					http_request = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					http_request = null;
				}
			}
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() {echo (http_request,'div_cooperation');
		};
        http_request.open('GET', url+'?lang='+ lang +'&id='+rnd, true);
		http_request.send(null);
    }

    function echo(http_request,item_n) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                document.getElementById(item_n).innerHTML=unescape(http_request.responseText);
				
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

var Lname
function Mover(Lindex)
{
	if(Lindex)
	{
		document.all[Lindex].style.display=''
		document.all[Lindex].style.visibility='visible'
		Lname=Lindex
	}
	else{
		document.all[Lname].style.display='none'
	 }
}
x=0
y=0
function Lscroll()
{
	x=document.body.scrollLeft
}
function Lscroll2()
{
	x2=document.body.scrollLeft
	y=x-x2
}
window.onscroll=Lscroll2
window.onresize=Lscroll
function Mmove(Lindex)
{
	offsetX =window.event.clientX-y
	offsetY =window.event.clientY+document.body.scrollTop	
	if(offsetX<document.body.clientWidth)
	document.all[Lindex].style.pixelLeft=offsetX-175
	document.all[Lindex].style.pixelTop=offsetY-50
	if(document.all[Lindex].style.pixelLeft<=5){
	document.all[Lindex].style.pixelLeft=5
	document.all[Lindex].style.pixelTop=offsetY-85
	}
}

    function load_data(id,url) {
        var rnd = Math.random();
		document.getElementById("load_map_data").innerHTML='<span class="normal_text">Loading Data</span>';
        var http_request = false;

        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) {
           
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					http_request = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					http_request = null;
				}
			}
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() {echo (http_request,'load_map_data');
		};
        http_request.open('GET', (url+'id='+id+'&rnd='+rnd), true);
		http_request.send(null);
    }

    function echo(http_request,item_n) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                document.getElementById(item_n).innerHTML=unescape(http_request.responseText);
				
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

