function changeBG(ctrl,clas)
{
	//document.getElementById('aa').style.backgroundImage='url(images/rtoprightmenu_03)';
	ctrl.className=clas;
}

function showhide(layer_ref,li) { 
hza = document.getElementById(layer_ref); 
hza1 = document.getElementById(li);  


if(hza.style.display == 'none') 
{
hza.style.display='block';
hza1.src='../images/up.png';

}
else
{ 
hza.style.display='none'; 
hza1.src='../images/down.png';

}
}

function openAll(count)
{ 
for(i=1;i<=count;i++)
{
document.getElementById("dady1"+i).style.display='block';
document.getElementById("eyad"+i).src='../images/up.png';
}
}
function closeAll(count)
{ 
for(i=1;i<=count;i++)
{
document.getElementById("dady1"+i).style.display='none';
document.getElementById("eyad"+i).src='../images/down.png';
}
}

function changecolor(id)
{
	id.style.backgroundColor='#931414';
}

function checkEmail() {

var email = document.getElementById('email');

var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

if (!filter.test(email.value)) {

//alert('?????? ????? ????? ????');

email.focus
document.getElementById('email').style.backgroundColor='#ff0000';

return false;

}document.getElementById('email').style.backgroundColor='';
}
function overcolor(id)
{
	document.getElementById(''+id+'').style.backgroundColor='#931414';
}

function outcolor(id)
{
	document.getElementById(''+id+'').style.backgroundColor='#F7F7F7';
}
function resetcolor(id)
{
	id.style.backgroundColor='#f9f9f9';
}

var pop;
function pop1(url)
{
        pop=window.open(url,'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=1, menubars=0, resizable=0, width=500, height=400');
        if (window.focus) {pop.focus()}
}

function popwindow(url,w,h)
{
        pop=window.open(url,'poppage', 'toolbars=0, scrollbars=1, location=0, statusbars=1, menubars=0, resizable=0, width='+w+', height='+h);
        if (window.focus) {pop.focus()}
}

function validrate()
{
	if(form1.select.value==-1)
	{
		alert('???? ???????');
		return false;
	}
}

function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}

function sss(img)
{
	if(img.width>416)
	{
		img.style.width=416;
		img.align='middle';
	}
}

function bookmark(title)
{
bookmarkurl=document.URLUnencoded;
bookmarktitle=title;
if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle);
else if (window.sidebar) // firefox
    window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
}
////////////////////////////////////////
var title=new Array();
var imgs=new Array();
var links=new Array();
var count=0;
var curr=0;

function changemain(indx)
{
	document.getElementById('title').innerHTML=title[indx];
	document.getElementById('img').src='uploads/'+imgs[indx];
	document.getElementById('downlink').href=links[indx];
	curr=indx;
	drawnumber(indx);
}

function drawnumber(bgn)
{
var j=1;
for(i=bgn;i<bgn+4;i++)
{
	if(i<count)
	{
		document.getElementById('tda'+j).innerHTML='<a href="javascript:void(0)" onclick="changemain('+i+')" >'+eval(i+1)+'</a>';
		j++;
	}
	else
{
		document.getElementById('tda'+j).innerHTML='<a href="javascript:void(0)"  >&nbsp;</a>';
		j++;
	}
}
}

function prev()
{
	//alert(curr);
	if(curr>0)
	changemain(curr-1);
	else
	changemain(0);
}

function next()
{
	curr++;
	if(curr>=count)
	{
		curr=count-1;
	}
	else
	changemain(curr);
}
/////////////////////////////////////////
function swapvedio(url)
{
document.getElementById("flvplayer").innerHTML="<img src=images/loding.gif width='450' height='350' />";
setTimeout("writes('"+url+"');",5000);

}

function swapvedios(url)
{
document.getElementById("flvplayer").innerHTML="<img src=images/loding.gif width='237' height='197' />";
setTimeout("writess('"+url+"');",5000);

}
function writess(url)
{
document.getElementById("flvplayer").innerHTML='<embed id="flvplayer" src="http://www.youtube.com/v/'+url
+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="237" height="197" bgcolor=#c6c6c6></embed>';
}

function writes(url)
{
document.getElementById("flvplayer").innerHTML='<embed id="flvplayer" src="http://www.youtube.com/v/'+url
+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="450" height="350" bgcolor=#c6c6c6></embed>';
}
function ShowHide(varObjID){
		if(document.getElementById(varObjID).style.display=="none"){
			document.getElementById(varObjID).style.display="block"; 
			//funSImg(varObjID);
		}else{
			document.getElementById(varObjID).style.display="none";
		}
}

function expand()
{
        var Nodes = document.getElementsByTagName("div")
        var max = Nodes.length
        for(var i = 0;i < max;i++) {
                var nodeObj = Nodes.item(i)
                var str = nodeObj.id
                if (str.match("div")) {
                        nodeObj.style.display = 'block';
                }
        }
}

function hideall()
{
        var Nodes = document.getElementsByTagName("div")
        var max = Nodes.length
        for(var i = 0;i < max;i++) {
                var nodeObj = Nodes.item(i)
                var str = nodeObj.id
                if (str.match("div")) {
                        nodeObj.style.display = 'none';
                }
        }
}

/////////////////////////////////////////////////////

var pdept=new Array();


var ardept=new Array();
var arrate=new Array();
var arname=new Array();
var datacount=0;
var curdept=0;
function drawdept( dept)
{
	
	document.getElementById("cat").innerHTML=pdept[dept+1];
	var location=getdeptdata(dept+1);
	//alert(location);
	var jj=1;//alert(location);
	
	for(i=location;i<location+3;i++)
	{
		
		if((dept+1) == ardept[i]){

		document.getElementById('prog'+jj).innerHTML=arname[i].substring(0,10);
		document.getElementById('prog'+jj).title=arname[i];
		document.getElementById('col'+jj).height=(arrate[i]*90/100);
		document.getElementById('p'+jj).innerHTML=Math.round(arrate[i])+'%';
		}
		else
		{
		document.getElementById('prog'+jj).innerHTML='N/A';
		document.getElementById('col'+jj).height=0;
		document.getElementById('p'+jj).innerHTML='N/A';
		}
		
		jj++;
	}
	curdept=dept;
}

function nextdept()
{
	curdept++;
	if(curdept>=20)
	curdept=19;
	drawdept(curdept);
}

function prevdept()
{
	curdept--;
	if(curdept<=0)
	curdept=0;
	drawdept(curdept);
}
function getdeptdata(dept)
{
	for(i=0;i<datacount;i++)
	{
		if(dept==ardept[i])
		{
			return i;
		}
	}
	return -1;
}
/////////////////////////////////////////////////////