var m_intMove = 0;
 
function Slide(p_intPosition, p_blnLeft) {			
	document.getElementById('Slide').style.left=p_intPosition+'px';
	document.getElementById('SlideNext').style.display='block';
	document.getElementById('SlidePrevious').style.display='block';

	if(p_blnLeft) {
		if(p_intPosition<(m_intMove+605)){
			setTimeout(
				function() { 						
					Slide(p_intPosition+5, p_blnLeft);		
				},
			1); 
		} else {
			m_intMove = p_intPosition;
			if(p_intPosition==0) {
				document.getElementById('SlidePrevious').style.display='none';
			}
		} 
	} else {
		if(p_intPosition>(m_intMove-605)){
			setTimeout(
				function() { 						
					Slide(p_intPosition-5, p_blnLeft);		
				},
			1); 
		} else {
			m_intMove = p_intPosition;
			if(m_intMove==-(document.getElementById('Slide').offsetWidth-605)) {
				document.getElementById('SlideNext').style.display='none';
			}
		} 
	}
}

function ShowCarrousel(p_intId) {
    var l_arrBigImg=document.getElementById('CarrouselBig').getElementsByTagName('div');
    for (var i = 0; i < l_arrBigImg.length; i++) { 
        l_arrBigImg[i].style.display='none';
    }
    document.getElementById('Carrousel' + p_intId).style.display='block';
}

function Show(p_objItem) {
    if(p_objItem.style.display=='block') {
        p_objItem.style.display='none';
    } else {
        p_objItem.style.display='block';
        p_objItem.style.zIndex=200;
    }
}

function ShowTab(p_intId) {
    if(p_intId==1) {
        document.getElementById('TabItem0').className='Tab';
        document.getElementById('TabItem1').className='TabBlueChosen';
    } else {
        document.getElementById('TabItem0').className='TabChosen';
        document.getElementById('TabItem1').className='TabBlue';
    }
    if(document.getElementById('Tab0')) {
        document.getElementById('Tab0').style.display='none';
        document.getElementById('TabLink0').style.display='none';
    }
    if(document.getElementById('Tab1')) {
        document.getElementById('Tab1').style.display='none';
        document.getElementById('TabLink1').style.display='none';
    }
    if(document.getElementById('Tab' + p_intId)) {
        document.getElementById('Tab' + p_intId).style.display='block';
        document.getElementById('TabLink' + p_intId).style.display='block';
    }
}


function isDate(p_strDate){
    var l_objRegExp=/^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/
    if(l_objRegExp.test(p_strDate)) {
        return true;
    } else {
        return false ;
    }
}

function isTime(p_strTime){
    var l_objRegExp=/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/
    if(l_objRegExp.test(p_strTime)) {
        return true;
    } else {
        return false ;
    }
}

function isEmail(p_strEmail) {
    var l_strEmail = p_strEmail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\..{2,2}))$)\b/gi);
	if (l_strEmail){
	    return true;
	} else {
	    return false;
	}
}

function ResetPage() {
    setTimeout("document.location=document.location", 1500);
}

function SendInvite() {
    SendRequest('/Ajax/Home/InviteFriend.aspx');
}

function SaveSendInvite() {
    var l_blnError = false;
    
    if(document.getElementById('MessageNaam').value == '') {
        alert ('Jouw naam is verplicht!');
        document.getElementById ('MessageNaam').focus();
        l_blnError = true;
    }
    if(document.getElementById('MessageNaamVriend').value == '') {
        alert ('Naam vriend is verplicht!');
        document.getElementById ('MessageNaamVriend').focus();
        l_blnError = true;
    }
    if(!isEmail(document.getElementById('MessageEmailVriend').value)) {
        alert ('E-mail is verplicht!');
        document.getElementById ('MessageEmailVriend').focus();
        l_blnError = true;
    }
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Home/InviteFriend.aspx', GetAllValues('FormInviteMessage'), ResetPage);
    }
}

function GoToReg() {
    document.location = document.getElementById('RegistrationLink').href;
}

function LoginFocus() {
    Show(document.getElementById('Login'));
    document.getElementById('Username').focus();
}

function ErrorLogin() {
    LoginFocus();
    document.getElementById('LoginError').style.display='block';
}
