// JavaScript Document
var mcdstatus=false;
var mcdscroll=false;
var mcdheight=0;
var cdstatus=false;
var cdheight=0;
var currentpage=0;
var looppages=true;
var offset=0;
var bool=false;
var myfead=0;
function checkEmail(f){
	if (f.email.value =="") {
		alert("Email Not Exist");
		return false;
	}
	ReAddr=/([a-zA-Z0-9_\-])+@([a-zA-Z0-9_\-])+\.([a-zA-Z])+/g;
	if(! (ReAddr.exec(f.email.value) ) ){
		alert("Email Not Correct");
		return false;
	} 
	return true;
}
function checkEmail1(f){
	if (f.emails.value =="") {
		alert("Email Not Exist");
		return false;
	}
	ReAddr=/([a-zA-Z0-9_\-])+@([a-zA-Z0-9_\-])+\.([a-zA-Z])+/g;
	if(! (ReAddr.exec(f.emails.value) ) ){
		alert("Email Not Correct");
		return false;
	} 
	return true;
}
function slide(){
	bool =!bool;
	if(bool){
		$$('div.d').each( function(e) { e.visualEffect('slide_up',{duration:1.5}) });
	}else{
		$$('div.d').each( function(e) { e.visualEffect('slide_down',{duration:1.5}) });
	}
}
function pmcd(){
	mcdstatus=!mcdstatus;
	if((!mcdstatus)&&(mcdscroll))return;
	var w='none';
	if(mcdstatus){
		w='block';
		if(e=document.getElementById('wcd')){
			e.style.display=w;
		}
	}
	nloop();
}
function nloop(){
	if(mcdstatus){
		if(mcdheight<30){
			mcdheight+=5;
			setTimeout('nloop()',50);
		}else{
			mcdheight=31;
		}
	}else{
		if(mcdheight>0){
			mcdheight-=5;
			setTimeout('nloop()',50);
		}else{
			mcdheight=0;
			if(e=document.getElementById('wcd')){
				e.style.display='none';
			}
		}
	}
	if(e=document.getElementById('mcd')){
	//	e.style.top=mcdheight;
	}
	if(e=document.getElementById('wcd')){
		e.style.height=mcdheight;
//		e.style.top=mcdheight-31;
	}
}
function cdover(){
	/*
	if(!cdstatus){
		document.getElementById('cd').style.display='block';
	//	document.getElementById('cdc').style.display='block';
	}
	cdstatus=!cdstatus;
	sloop();
	//*/
}
function sloop(){
	if(cdstatus){
		if(cdheight<30){
			cdheight+=5;
			setTimeout('sloop()',50);
		}else{
			cdheight=31;
		}
	}else{
		if(cdheight>0){
			cdheight-=5;
			setTimeout('sloop()',50);
		}else{
			cdheight=0;
			if(e=document.getElementById('cd')){
				e.style.display='none';
			}
			if(e=document.getElementById('cdc')){
			//	e.style.display='none';
			}
		}
	}
	if(e=document.getElementById('cd')){
		e.style.height=cdheight;
	}
	if(e=document.getElementById('cdc')){
		//e.style.top=cdheight-31;
		e.style.height=cdheight;
	}
}
function setpage(id){
	currentpage=id;
	for(i=1;i<7;i++){
		if(e=document.getElementById('a'+i)){
			e.style.display='none';
		}
		if(e=document.getElementById('n'+i)){
			e.className='agentnum';
		}
	}
	if(e=document.getElementById('a'+id)){
		e.style.display='block';
	}
	if(e=document.getElementById('n'+id)){
		e.className='agentnum1';
	}
	looppages=false;
}
function looppage(){
	if(!looppages){
		return;
	}
	var x=7;
	var i=0;
	for(i=1;i<x;i++){
		if(e=document.getElementById('a'+i)){
			e.style.display='none';
		}else{
			x=i;
		}
		if(e=document.getElementById('n'+i)){
			e.className='agentnum';
		}
	}
	x--;
	currentpage++;
	if(currentpage>x){
		currentpage=1;
	}
	if(e=document.getElementById('a'+currentpage)){
		e.style.display='block';
	}
	if(e=document.getElementById('n'+currentpage)){
		e.className="agentnum1";
	}
	myfead=0;
	fead();
	setTimeout("looppage()",5000);
}
function fead(){
	myfead+=5;
	if(e=document.getElementById('fead')){
		e.style.filter = "alpha(opacity="+myfead+")" ;
	}
	if(myfead<100){
		setTimeout("fead()",100);
	}
}
function loopmarq(dir,loop){
	if(dir=='rtl'){
		offset+=10;
		if(offset>685){
			offset=0;
		}
	}else{
		offset-=10;
		if(offset<0){
			offset=685;
		}
	}
	document.getElementById('marq').scrollLeft=offset;
	if(loop){
		setTimeout("loopmarq('"+dir+"',"+loop+")",100);
	}
}
function test(){
	/*
	$('div.d').click(function(e){e.visualEffect('slide_down',{duration:1.5})});
	$('div.d').click(function(e){e.visualEffect('slide_up'  ,{duration:1.5})});
	//*/
}
function myload(){
	if(e=document.getElementById('mybody')){
		e.style.height=screen.height-600;
	}
}
