/* Other Script */

loadImg=new Image();
loadImg.src='loading.gif';
var iBuffer=new Image();
var u;
function $(id) { return document.getElementById(id); }
function waitSwap(newImg, holder, Num)
{
$('LoadingLogo').style.display = 'block'; $('LoadingLogo').src='loading.gif';$('thePic').style.display = 'none';$('TextPanel').style.display= 'none';$('C1').style.display= 'none';$('C2').style.display= 'none';$('C3').style.display= 'none';
iBuffer.onload=(function(img, h){return function(){document.images[h].src=img;$('LoadingLogo').style.display = 'none';$('thePic').style.display = 'block';$('TextPanel').style.display = 'block';$('C1').style.display= 'block';$('C2').style.display= 'block';$('C3').style.display= 'block';u=setTimeout("ChangeSize()",1);}})(newImg, holder);
iBuffer.src=newImg;
var number='Num'+Num;
$('TextPanel').innerText=$(number).lang;
$('thePic').alt = $(number).lang;
setPage(Num-1);
return false;
}
function ChangeSize()
{
var width = $('thePic').width
$('PicPanel').style.width=width + 'px';
var pic = width-55;
$('TextPanel').style.width= pic + 'px';
clearTimeout(u);
}
function ChangeSizeFirst(newImg, holder, Num)
{
$('LoadingLogo').style.display = 'block'; $('LoadingLogo').src='loading.gif';$('thePic').style.display = 'none';$('TextPanel').style.display= 'none';$('TextPanel').style.display= 'none';$('C1').style.display= 'none';$('C2').style.display= 'none';$('C3').style.display= 'none';
iBuffer.onload=(function(img, h){return function(){document.images[h].src=img;$('LoadingLogo').style.display = 'none';$('thePic').style.display = 'block';$('TextPanel').style.display = 'block';$('C1').style.display= 'block';$('C2').style.display= 'block';$('C3').style.display= 'block';}})(newImg, holder);
iBuffer.src=newImg;
var smhPic = new Image();
smhPic.src = newImg;
setPage(Num);
$('TextPanel').innerText= $('Num1').lang;
$('thePic').alt = $('Num1').lang;
var widthF = smhPic.width;
var heightF = smhPic.height;
var widthP = 425*widthF/heightF;
$('PicPanel').style.width=widthP + 'px';
var sj = widthP-55;
$('TextPanel').style.width=sj + 'px';
}

var hist = null;
function setPage(crtPage)
{
var arr =  document.getElementById("nav").getElementsByTagName("a");
var val1 = hist;
for(var i=0; i < arr.length; i++)
{
if(i == val1)
{
hist = crtPage;
arr[i].className = "";
arr[i].parentNode.className = "";
hist = crtPage;
c=crtPage;
}
if(i == crtPage)
{
var val1 = hist;
hist = crtPage;
arr[i].className = "current";
arr[i].parentNode.className = "current";
hist = crtPage;
c=crtPage;
}
}
}

function $(id) { return document.getElementById(id); }
function MarginSetting() 
{
var myWidth = 0, myHeight = 0;
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
var margintop;
if(423<myHeight)
{var hi = myHeight - 423; var hi2 = hi/2; margintop = hi2 + 'px';}
else
margintop = '0px';

$("smh").style.marginTop = margintop;
}

/* FadeEffect */

var faders=[];
// Preset each image's initial opacity (0 to 100):
// ex:  faders[x]=['image_id', initial_opacity];
faders[0]=['mona', 50];
faders[1]=['arch', 0];

////////////// Stop Editing //////////////

function fade(el, way, op, opinc, speed){
if(!fade.prprt&&!fade.ie)
return;
var id=typeof el=='string'? el : el.id, el=typeof el=='object'? el : document.getElementById(el);
clearTimeout(fade[id+'timer']);
var op_obj=fade.ie6? el.filters[0] : el.style,
waym=way=='in'? 1 : -1, speed=speed? speed*1 : 30, opinc=opinc&&opinc>=1? opinc*(fade.ie? 1 : .01) : opinc? opinc : fade.ie? 5 : .05,
op=op&&fade.ie? op*1 : op&&op*1>=1? Math.min(op*.01, .99) : op? op : waym>0&&fade.ie? 100 : waym>0? .99 : 0;
if(!fade.ie6&&!fade[id+'yet']){
if(fade.prprt)
op_obj[fade.prprt]=Math.min(fade.preset(id)*.01, .99);
else if(fade.ie)
op_obj.filter='alpha(opacity='+fade.preset(id)+')';
fade[id+'yet']=true;
}
if(fade.prprt&&Math.abs(op*1-op_obj[fade.prprt]*1)<opinc)
op_obj[fade.prprt]=op;
else if(fade.prprt)
op_obj[fade.prprt]=fade.ie6? op_obj[fade.prprt]*1 + opinc*waym : Math.min(op_obj[fade.prprt]*1 + opinc*waym, .99);
else if (fade.ie&&Math.abs(op*1 - op_obj.filter.replace(/\D/g,'')*1)<opinc)
op_obj.filter='alpha(opacity='+op+')';
else if (fade.ie)
op_obj.filter='alpha(opacity='+[op_obj.filter.replace(/\D/g,'')*1 + opinc*waym]+')';
else
return;
if(op_obj[fade.prprt]&&op_obj[fade.prprt]*waym<op*waym||!fade.ie6&&fade.ie&&op_obj.filter.replace(/\D/g,'')*waym<op*waym)
fade[id+'timer']=setTimeout(function(){fade(el, way, op, opinc, speed)}, speed);
}
if(document.documentElement&&document.documentElement.style){
fade.d=document.documentElement, fade.t=function(o){return typeof fade.d.style[o]=='string'}; if(fade.d.filters)
document.write('<span id="ie_test" style="filter:progid:DXImageTransform.Microsoft.alpha(opacity=0);position:absolute;top:-1000px;">p<\/span>');
fade.ie=fade.d.filters&&ie_test.filters[0], fade.ie6=fade.ie&&typeof ie_test.filters[0].opacity=='number',
fade.prprt=fade.t('opacity')||fade.ie6? 'opacity' : fade.t('MozOpacity')? 'MozOpacity' : fade.t('KhtmlOpacity')? 'KhtmlOpacity' : null;
}
fade.set=function(){
var prop=fade.prprt=='opacity'? 'opacity' : fade.prprt=='MozOpacity'? '-moz-opacity' : '-khtml-opacity';
document.write('\n<style type="text/css">\n')
for (var i = 0; i < faders.length; i++)
document.write('#'+faders[i][0]+' {\n'+
(fade.ie? 'filter:progid:DXImageTransform.Microsoft.alpha(opacity='+faders[i][1]+')' : prop+':'+Math.min(faders[i][1]*.01, .99))+';\n}\n');
document.write('<\/style>\n')
}
fade.preset=function(id){
for (var i = 0; i < faders.length; i++)
if (id==faders[i][0])
return faders[i][1];
return 0;
}
if(fade.prprt||fade.ie)
fade.set();

//Setting For Aouto Play 


var act;
function timedCount()
{
if(act!=1){act=1; $('C2').src='http://www.abbaskowsari.com/File_Sys/Image/Play.gif'; AutoPlay(); }
else{act=0; $('C2').src='http://www.abbaskowsari.com/File_Sys/Image/Pause.gif'; stopCount(); }
}
var c;
var len;
var t;
function AutoPlay()
{
var ArrayNav = document.getElementById("nav").getElementsByTagName("a");
len = ArrayNav.length;
if(c==null){c=0}
    if(len>c)
    {
        var Name = ArrayNav[c].attributes.getNamedItem("onclick").value;
        Name = Name.replace("return waitSwap(","");
        Name = Name.replace(")","");
        Name = Name.replace("'","");
        Name = Name.replace("'","");
        Name = Name.replace("'","");
        Name = Name.replace("'","");
        Name = Name.replace(";","");
        var arratribute = Name.split(',');
        waitSwap(arratribute[0], arratribute[1],arratribute[2]);
        c=c+1;
        t=setTimeout("AutoPlay()",10000);
    }
    else
    {
        c=0;
        t=setTimeout("AutoPlay()",10000);
    }
}


function stopCount()
{
    clearTimeout(t);
}
function NextFrame()
{
var ArrayNav = document.getElementById("nav").getElementsByTagName("a");
len = ArrayNav.length;
c=c+1;
if(c==null)
   c=0
    if(len>c)
    {
    var Name = ArrayNav[c].attributes.getNamedItem("onclick").value;
    Name = Name.replace("return waitSwap(","");
    Name = Name.replace(")","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace(";","");
    var arratribute = Name.split(',');
    waitSwap(arratribute[0], arratribute[1],arratribute[2]);

    }
    else{c=0;NextFrame();}
}
function PreFrame()
{
var ArrayNav = document.getElementById("nav").getElementsByTagName("a");
len = ArrayNav.length;
c=c-1;
if(c==null ||c==len ) {c=0;}
if(c==-1 || c>len) {c=len-1;}
    var Name = ArrayNav[c].attributes.getNamedItem("onclick").value;
    Name = Name.replace("return waitSwap(","");
    Name = Name.replace(")","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace("'","");
    Name = Name.replace(";","");
    var arratribute = Name.split(',');
    waitSwap(arratribute[0], arratribute[1],arratribute[2]);
    
}
//End For Aouto Play 
