﻿var clickedRegister = false;
function catchRegister (evt){
	e = (isIE)? (window.event):(evt);

	if(e.keyCode==13){
		clickedRegister = true;
		registerEmail(false);
		if (e.cancelBubble) e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		if (e.returnValue) e.returnValue = false;
		if (e.cancel) e.cancel = false;
		return false;
	}
}

function registerEmail(){
	var o = $('mailToRegister');
	if (o){
		if (validateEmail ( o.value)  ){
			if (document.forms[0]){document.forms[0].onsubmit = function(){return false};}
			mailFrame.location.href= 'register_email.aspx?email='+o.value;
		}else{
			alert ("Please type valid email address");
			o.focus();
		}
	}
}


function validateEmail(val){
	var rule = /^[a-z][\w\-\.]*@([a-z0-9\-]+\.)+[a-z]{2,}$/i;
	return rule.test (val);
}


function respondRegister(){
	setClass("signupForm", "off");
	setClass("signupAnswer", "block");
}


function flashHighlight(flashLabel){
	var o = $("hpTopFlash");	
	if(o){
		try{
			o.TCallLabel("/", flashLabel);
		}catch(e){}
	}
}




//$DL(
//	function(){		
//	
//	var accordion = new Accordion('li.atStart', 'div.atStart', {
//	opacity: true,
//	show:4,
//	duration:800,
//	fixedHeight: 170,
//	fixedWidth:245,
//	alwaysHide:true,
//	onActive: function(toggler, element){
//        toggler.addClass ("open");
//	},
// 
//	onBackground: function(toggler, element){
//        toggler.removeClass ("open");
//	}
//}, $('accordion'));
//	},5
//);

$DL(function(){
	HpTicker.init();
	var flashReplaceElement=$('flashContentReplace');
	if(flashReplaceElement!=null){
		if(deconcept.SWFObjectUtil.getPlayerVersion().major==0)
			flashReplaceElement.show();
	}
	

	
});
var HpTicker={
	index:0,
	init:function(){
		var items=$("partners").getElements(".partners-promo-item");		
//		var mark=$("partners").getElement(".mark");		
//		var lastRight;
//		var circleList=$("partners").getElements(".circle");
//		circleList.each(function(item,index){
//			item.setStyles({"right":index*17});
//			lastRight=item.getStyle("right").toInt();
//		});
//		var markRight=lastRight;
//		mark.setStyles({"right":markRight});
		var f=function(){
			if(HpTicker.index<9){
				items[HpTicker.index].setStyle("display","none");
				if(items[HpTicker.index+1])items[HpTicker.index+1].setStyle("display","block");
				HpTicker.index++;	
				//markRight-=17;
				//mark.setStyles({"right":markRight});
			}
			else {
				items[items.length-1].setStyle("display","none");
				items[0].setStyle("display","block");
				HpTicker.index=0;
				//markRight=lastRight;
				//mark.setStyles({"right":markRight});
			}
		};
		HpTicker.timer=f.periodical(4000);
	}
};
