
	
function close_all(xzy)
{
for(i=1;i<=4;i++)
	{
toggleDivclose('m'+i,i,xzy)
	
	}
}
var zzzz='0';
var TimerIDArray = new Array()
var TimeIDCount = 0;

function toggleDiv(id,x,zed) {



if(id == 'm1') {
 b = '1' 
 }
if(id == 'm2') {
 b = '2'
 }
if(id == 'm3') { 
b = '3'
}
if(id == 'm4') { 
b = '4'
}
getopen(id,b);

for(i=1;i<=4;i++)
	{
	if(id == 'm'+i) getopen(id,i);
	else
	{
	toggleDivclose('m'+i,i,zed)
	}
	}
if(zzzz=='1')
{

for (i = 0 ; i < TimeIDCount ; i++)
{
	
	window.clearTimeout(TimerIDArray[i]);
	
}

}


TimerIDArray[TimeIDCount++] = window.setTimeout('toggleDivclose("'+id+'","'+b+'","'+zed+'")',6000);


zzzz = '1';
}

function getopen(id,x)
{


if (document.layers) {
	document.layers[''+id+''].visibility = "show"
	document.layers['l'+x+''].className = "xmenu"
}
else if(document.all) {
	 document.all[''+id+''].style.visibility = "visible"
	 document.all['l'+x+''].className = "xmenu"
}
else if (document.getElementById)
{ 
	 document.getElementById(''+id+'').style.visibility = "visible"
	 document.getElementById('l'+x+'').className = "xmenu"
}


}

function return_status(id)
{
if (document.layers) x = document.layers[''+id+''].visibility
else if (document.all)  x = document.all[''+id+''].style.visibility
else if (document.getElementById) x = document.getElementById(''+id+'').style.visibility

if(x == 'show' || x == 'visible') return '1'
else return '0'
}

function toggleDivclose(id,b,zedd) {

z = return_status(id);

if(z == 1)
{
if (document.layers) 
{
	document.layers[''+id+''].visibility = "hide"
		
	if(zedd !== 'l'+b) document.layers['l'+b+''].className = "lex"
}
else if (document.all) 
{
	document.all[''+id+''].style.visibility = "hidden"
	if(zedd !== 'l'+b) document.all['l'+b+''].className = "lex"
}
else if (document.getElementById) 
{
	document.getElementById(''+id+'').style.visibility = "hidden"
	if(zedd !== 'l'+b) document.getElementById('l'+b+'').className = "lex"
}

}
}


function waitPreloadPage() { //DOM
if (document.getElementById){
document.body.style.visibility='visible';
}else{
if (document.layers){ //NS4
document.body.visibility = 'visible';
}
else { //IE4
document.all.body.style.visibility = 'visible';
}
}
}
// End -->



function setTimeoutOnce(aTimeoutCall, aDelay) {
  for (var i = 0; i < setTimeoutOnce.schedule.length; i++) {
    var timeout = setTimeoutOnce.schedule[i];
    if ((timeout.command == aTimeoutCall)&&(timeout.delay == aDelay)&&(!timeout.hasExecuted)) {
      return;
    }
  }
  timeout = {command: aTimeoutCall, delay: aDelay, hasExecuted: false};
  var aIndex = setTimeoutOnce.schedule.length;
  tttt = setTimeout("setTimeoutOnce.process("+ aIndex +")", aDelay);
  setTimeoutOnce.schedule[aIndex] = timeout;
  dump(aTimeoutCall + " scheduled for one-time run in " + aDelay + " milliseconds\n");
}
setTimeoutOnce.schedule = [];
setTimeoutOnce.process = function(aIndex) {
  var timeout = setTimeoutOnce.schedule[aIndex];
  if (!timeout.hasExecuted) {
    eval(timeout.command);
    dump(timeout.command + " has executed one-time run after " + timeout.delay + " milliseconds\n");
    timeout.hasExecuted = true;
  }
  return tttt;
}


var state = 'none';
var image = 'bullet.gif';

function showhide(layer_ref,image_ref) {

if (state == 'block') {
state = 'none';
image = 'bullet.gif';
}
else {
state = 'block';
image = 'bullet2.gif';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}

if(image_ref !== '0')
{
iza = document.getElementById(image_ref);
iza.src = './images/'+image;
}

}


var states = 'none';

function showhide2(layer_ref2) {

if (states == 'block') {
states = 'none';
}
else {
states = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref2 + ".style.display = states");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref2].display = states;
}
if (document.getElementById &&!document.all) {
ben = document.getElementById(layer_ref2);
ben.style.display = states;
}
}



var statez = 'none';
var imagez = 'big_bullets.gif';

function showhide_news(layer_ref) {

	if (statez == 'block') {
	statez = 'none';
	}
	else {
	statez = 'block';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
	eval( "document.all." + layer_ref + ".style.display = statez");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
	document.layers[layer_ref].display = statez;
	}
	if (document.getElementById &&!document.all) {
	hza = document.getElementById(layer_ref);
	hza.style.display = statez;
	}
	

}












// scrolling ... main page


var Scroller = function(frameId,contentId,direction,tempo,w,h)
{
	// default parameters
	var thisObj 		= this;
	this.nXlocation 	= 0;
	this.nYlocation 	= 0;
	this.nFrameHeight 	= h;
	this.nFrameWidth	= w;
	this.nTempo			= tempo;
	this.strDirection	= direction;
	this.scrollerStat	= true;
	this.objFrame		= document.getElementById(contentId);
	
	// frame parameter
	f = document.getElementById(frameId);
	f.style.height 	= h+'px';
	f.style.width 	= w+'px';

	this.MoveScroller = function()
	{
		switch(this.strDirection)
		{
			case 'u':	// moving up
				this.nXlocation--;
				this.objFrame.style.top=this.nXlocation+"px";
				break;
			case 'd':	// moving sown
				this.nXlocation++;
				this.objFrame.style.top=this.nXlocation+"px";
				break;
			case 'r':	// moving right
				this.nYlocation++;
				this.objFrame.style.left=this.nYlocation+"px";
				break;
			case 'l':	// moving left
				this.nYlocation--;
				this.objFrame.style.left=this.nYlocation+"px";
				break;
		}
	}

	this.CheckScroller = function()
	{
		switch(this.strDirection)
		{
			case 'u':
				if ((0-this.nXlocation) > this.objFrame.offsetHeight)
				this.nXlocation = this.nFrameHeight;
				break;
			case 'd':
				if (this.nXlocation > this.nFrameHeight)
				this.nXlocation = -this.objFrame.offsetHeight;
				break;
			case 'r':
				if (this.nYlocation > this.nFrameWidth)
				this.nYlocation = -this.objFrame.offsetWidth;
				break;
			case 'l':
				if ((0-this.nYlocation) > this.objFrame.offsetWidth)
				this.nYlocation = this.nFrameWidth;
				break;
		}	
	}
	
	this.RunScroll = function()
	{
		if (this.scrollerStat)
		{
			this.MoveScroller();
			this.CheckScroller();
		}
	}
	
	this.StartScroll = function()
	{
		setInterval(function() { thisObj.RunScroll(); },thisObj.nTempo);
	}


this.StopScroll = function()
{
this.scrollerStat = false;
}

this.ContinueScroll = function()
{
this.scrollerStat = true;
}


}

/*
 * Enables/disables a document element
 * @param id the id of the element
 * @param endisable when this parameter is ommited the element visibility is negated
 */
function endisableElement(id, endisable, imageId) {
	var element = document.getElementById(id);
	if (element) {
		var visibility;
		if (endisable == true) 
			visibility = "block";
		else if (endisable == false)
			visibility = "none";
		else 
			visibility = (element.style.display == "block" ? "none" : "block");
			
		if (imageId)
			document.getElementById(imageId).src=(visibility=="block" ? "images/arrow_open.gif" : "images/arrow_close.gif");
		
		element.style.display = visibility;
	} else
		alert("Error: element with id '" + id + "' doesn't exist");
}

function updatePrice(elementId, val, loggedIn) {
	if (elementId == 'product') {
		document.reg.productValue.value=parseInt(val);
	} else if (elementId == 'period') {
		document.reg.periodValue.value=parseInt(val);
	}
	productValue = document.reg.productValue.value;
	periodValue = document.reg.periodValue.value;
	if (productValue!="" && periodValue!="")
		new RSPA.Execute('MyClass.calculatePrice()', {parameters: new Array(loggedIn,productValue,periodValue,document.reg.disa.value),controller: 'framework/Controller.php', statusPane:'priceLoading', loadStatus:'ومُْ...'});
}

function updateText(elementId, txt) {
	document.getElementById(elementId).innerHTML=txt;
}

function firstTimeAjax(loggedIn) {
	//
	//productValue = document.reg.productValue.value;
	//if (productValue == 0) {
//		productValue = 2;
//		document.reg.productValue.value = 2;
//	}
//	periodValue = document.reg.periodValue.value;
//	if (periodValue == 0) {
		//''periodValue = 2;
		//document.reg.periodValue.value = 2;
	//}
	//document.reg.product[productValue-1].checked=true;
	//document.reg.period[periodValue-1].checked=true;
//	  new RSPA.Execute('MyClass.calculatePrice()', {parameters: new Array(loggedIn,document.reg.productValue.value,document.reg.periodValue.value,document.reg.disa.value), controller: 'framework/Controller.php', statusPane:'priceLoading', loadStatus:''});
	if (!loggedIn)
		new RSPA.Execute('MyClass.checkUsername()', {parameters: new Array(document.reg.username.value),controller: 'framework/Controller.php', statusPane:'usernameLoading', loadStatus:''});
}


