// JavaScript Document

function $(name) { 
if (document.getElementById) { 
return document.getElementById(name); 
} 
else if (document.all) 
{ 
return document.all[name]; 
} 
else if (document.layers) 
{ 
return document.layers[name]; 
} } 

function fast(id){

$(id).scrollAmount = $("etelaeyeh_marq").scrollAmount+1;}

function slow(id){

$(id).scrollAmount =$("etelaeyeh_marq").scrollAmount-1;}

function stop(id){

$(id).scrollAmount =0;}

function getyobj(id){

return($(id).offsetHeight);}

function getxobj(id){

return($(id).offsetWidth);}

function getLobj(id){

return($(id).offsetLeft);}
function getTobj(id){
return($(id).offsetTop);}
function cursorPos(){

var y;

	y= event.clientY;

	return y;

	}
function moveDirection(oldPos){

var newPos =cursorPos();

if(newPos > oldPos){

return("down");

}else{

return("up");

}}
function changeDirection(type,id){

if(type==0){

basePos = getyobj("etelaeyeh_marq")*2;

newdir = moveDirection(basePos);

}else if(type==1){

newdir = "up";}

else if(type==2){

newdir = "down";

}

$(id).direction = newdir;}
/***************************************/
function changecss(theClass,element,value) {

	//Last Updated on June 23, 2009

	//documentation for this script at

	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html

	 var cssRules;

	 var added = false;

	 for (var S = 0; S < document.styleSheets.length; S++){

    if (document.styleSheets[S]['rules']) {

	  cssRules = 'rules';

	 } else if (document.styleSheets[S]['cssRules']) {

	  cssRules = 'cssRules';

	 } else {

	  //no rules found... browser unknown

	 }

	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {

	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {

	    if(document.styleSheets[S][cssRules][R].style[element]){

	    document.styleSheets[S][cssRules][R].style[element] = value;

	    added=true;

		break;

	    }

	   }

	  }

	  if(!added){

	  if(document.styleSheets[S].insertRule){

			  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);

			} else if (document.styleSheets[S].addRule) {

				document.styleSheets[S].addRule(theClass,element+': '+value+';');

			}

	  }

	 }

	}
function fadeBar(num){

property = "progid:DXImageTransform.Microsoft.Alpha(opacity="+num+")";

changecss('.imagesBar','filter',property);

/*changecss('.imagesBar','opacity',".90");*/}
/*function bar_position(){$("Bar").style.top=offsetTop("tbl")+$("mainImage").height+255;$("Bar").style.width=$("mainImage").width+30;}*/
/********************Exam pages function****************************/
function disable_pages(){

$('disable_div').style.display='block';
$('form_fail').style.display='block';

	}
function close_form(){
$('disable_div').style.display='none';
$('form_fail').style.display='none';

	}
function divxy(id){
	$(id).style.height=getyobj('main');
	$(id).style.width=getxobj('main');
	$(id).style.marginLeft=getLobj('main')-4;
	$(id).style.marginTop= "45px";

	}

function page_load(){

	divxy('disable_div');

	}


