/*****************************/
function validate()
{
	if(form1.yourname.value!="")
	{
		if(form1.practicename.value!="")
		{
			if(form1.practiceid.value!="")
			{
				if(form1.email.value!="")
				{
					em = form1.email.value;
					if(em.indexOf("@") < 0 )
					{
						alert('You have not entered a valid email address');
						return false;
					}
					return true;
				}
			}
		}
	}
	alert('Please fill out all contact details before sending this form');	
	return false;
}
/*******************************************/
function domainwantedChanged()
{
	dw = form1.domainwanted.value;
	if(dw=="yes")
		form1.domain.value=" --- type your preferred domain name here ---";
	else
		form1.domain.value="";
}
/*******************************************/
function contactChanged()
{
	cw = form1.contactwanted.value;
	if(cw=="email")
	{
		form1.contacttime.value="";
		form1.contactday.value="";
	}
	else
	{
		form1.contacttime.value="Any time";
		form1.contactday.value="Any day";
	}
}
/*******************************************/
function timeChanged()
{
	cw = form1.contactwanted.value;
	if(cw=="email")
	{
		ct = form1.contacttime.value;
		cd = form1.contactday.value;
		if((ct!="")||(cd!=""))
		{
			form1.contactwanted.value="call";
			if(ct=="")
				form1.contacttime.value="Any time";
			if(cd=="")
				form1.contactday.value="Any day";
		}
	}
}
/*******************************/
/**** Used by Flash Carousel to open pics in Lightbox ******/
function aclick(anchor_id) {
    var a = document.getElementById(anchor_id);
    if(a){
//        myLightbox.start(a);
        window.open(a.href);
    }        
} 
/*************** Find out more ***********************/
// Move an element directly on top of another element (and optionally
// make it the same size)
function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.display = 'block';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
      }
}
//****//
function findOutMore(infoField,fadeField,infoButton, w,h)
{
    var vInfo = $get(infoField);
    if(vInfo.style.display=="block")
        return;
    var vFade = $get(fadeField);        
    Cover($get(infoButton),vFade);
    moveItem(vFade,vInfo,-200,100,w,h,false);    
}
function closeFindOutMore(infoField)
{
    var vInfo = $get(infoField);
    moveItem(vInfo,null,200,-100,0,0,true);
}
function moveItem(vItem,vInfo,top,left,width,height,bHide)
{
    var t = vItem.offsetTop;
    var tInc = 10;
    if(top<0)
        tInc=-10;
    if(bHide)
        tInc *= 2;
    top = top + t;
    
    var l = vItem.offsetLeft;
    var lInc=5;
    if(left<0)
        lInc=-5;
    if(bHide)
        lInc *= 2;
    left = left + l;
    
    var h = vItem.offsetHeight;
    var hInc = 10;
    if(height<h)
        hInc=-50;
        
    var w = vItem.offsetWidth;
    var wInc = 10;
    if(width<w)
        wInc=-50;
        
    function doMove()
    {
        var bTop = Math.abs(top-t) > Math.abs(tInc);
        var bLeft = Math.abs(left-l) > Math.abs(lInc);
        var bWidth = (width>=0) && (Math.abs(width-w) > Math.abs(wInc));
        var bHeight = (height>=0) && (Math.abs(height-h) > Math.abs(hInc));
        if(bTop || bLeft || bHeight || bWidth)
        {
            if(bTop)
            {
                t=t+tInc;
                vItem.style.top = t + "px";
            }
            
            if(bLeft){
                l=l+lInc;
                vItem.style.left = l + "px";
            }
                        
            if(bWidth) {
                w = w+wInc;
                vItem.style.width = w + "px";
            }
            
            if(bHeight) {
                h=h+hInc;
                vItem.style.height = h + "px";
            }
        }
        else
        {
            clearInterval(intId1);
            if(bHide)
            {
                vItem.style.display="none";
                vItem.style.top = top + "px";
                vItem.style.left = left + "px";
                vItem.style.width = width + "px";
                vItem.style.height = height + "px";
            }
            else
            {
                vItem.style.top = top + "px";
                vItem.style.left = left + "px";
                Cover(vItem,vInfo);
                vItem.style.display="none";
            }
        }
    }
    var intId1 = setInterval( doMove,10);
}
/*                        
        <ajaxToolkit:AnimationExtender ID="CloseAnimation" runat="server" TargetControlID="btnClose">
            <Animations>
                <OnClick>
                    <Sequence AnimationTarget="info">
                        <%--  Shrink the info panel out of view --%>
                        <StyleAction Attribute="overflow" Value="hidden"/>
                        <Parallel Duration=".3" Fps="15">
                            <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />
                            <FadeOut />
                        </Parallel>
                        
                        <%--  Reset the sample so it can be played again --%>
                        <StyleAction Attribute="display" Value="none"/>
                        <StyleAction Attribute="width" Value="250px"/>
                        <StyleAction Attribute="height" Value=""/>
                        <StyleAction Attribute="fontSize" Value="12px"/>
                        <OpacityAction AnimationTarget="btnCloseParent" Opacity="0" />
                        
                        <%--  Enable the button so it can be played again --%>
                        <EnableAction AnimationTarget="btnInfo" Enabled="true" />
                    </Sequence>
                </OnClick>
                <OnMouseOver>
                    <Color Duration=".2" PropertyKey="color" StartValue="#FFFFFF" EndValue="#FF0000" />
                </OnMouseOver>
                <OnMouseOut>
                    <Color Duration=".2" PropertyKey="color" StartValue="#FF0000" EndValue="#FFFFFF" />
                </OnMouseOut>
            </Animations>
        </ajaxToolkit:AnimationExtender>
*/


//**************************************************
//News
//**************************************************
var maxh = 0;
var pause=0;
var stop=0;
var dataobj;
var nTimeId=0;
function ScrollStart()
{
    clearTimeout(nTimeId);
    dataobj=document.getElementById("scrollingDiv")
    if(dataobj!=null)
    {
        maxh = dataobj.scrollHeight;
        maxh = dataobj.scrollHeight;
        maxh -= dataobj.offsetHeight;
        if(maxh>0)
        {
            NewsScrollGo();
        }
    }
}
//***************************************************
function NewsScrollGo()
{
    dataobj.scrollTop=0;
    nTimeId = setTimeout("NewsScrollNewsDiv()",1000 );
}

//***************************************************
function NewsScrollReset()
{
    if(stop==0 && pause==0)
    {
        dataobj.scrollTop=dataobj.scrollTop-10;
        if(dataobj.scrollTop>0)
        {
            nTimeId=setTimeout("NewsScrollReset()",10)
        }
        else
        {
            nTimeId=setTimeout("NewsScrollNewsDiv()",1000)
        }
    }
    else
        nTimeId=setTimeout("NewsScrollReset()",1000)
  
}
//***************************************************
function NewsScrollNewsDiv()
{
    if(stop==0 && pause==0)
    {
        dataobj.scrollTop=dataobj.scrollTop+1;
        if(dataobj.scrollTop>=maxh)
        {
            nTimeId=setTimeout("NewsScrollReset()",3000)
        }
        else
        {
            nTimeId=setTimeout("NewsScrollNewsDiv()",50)
        }
    }
    else
        nTimeId=setTimeout("NewsScrollNewsDiv()",1000)
}
