﻿	<!-- Begin
	/* This script and many more are available free online at
	The JavaScript Source!! http://javascript.internet.com
	Created by: Ultimater :: http://ultimiacian.tripod.com/
	Add this snippet to the very beginning of your script. */

	if(!document.getElementById){
	if(document.all)
	document.getElementById=function(){
		if(typeof document.all[arguments[0]]!="undefined")
		return document.all[arguments[0]]
		else
		return null
	}
	else if(document.layers)
	document.getElementById=function(){
		if(typeof document[arguments[0]]!="undefined")
		return document[arguments[0]]
		else
		return null
	}
	}
	// End -->

function FindMyControl(MyID) {

	var frmElements,i,t,ctl;
	
	// Since the use of master pages mangles the names of child controls, we need a method 
	// of searching through the form elements and returning a reference to the control we are 
	// looking for that control by the name we know it as instead of the dumb-ass name ASP.Net creates.
	// First scan through all of the input elements and look for our control
    frmElements=document.getElementsByTagName('input');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }
   // Still not found, scan through all of the select elements
    frmElements=document.getElementsByTagName('select');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    } 
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('textarea');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('td');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }      
   
   // Still not found, scan through all of the textarea elements
    frmElements=document.getElementsByTagName('img');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    } 
    
   // Still not found, scan through all of the iframe elements
    frmElements=document.getElementsByTagName('div');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }              

   // Still not found, scan through all of the iframe elements
    frmElements=document.getElementsByTagName('iframe');
    for(i in frmElements)
    {
        t = String(frmElements[i].id); 
        t = '_' + t;
        if (t.indexOf(MyID) > -1 )
            { return frmElements[i] }
    }        
   
    return false;         

}       

        
function MoveFloatingLink() {

            var el;
            var left,top,html,el2;

            // move the floating info link
            el = document.getElementById('imgRelative');
            if ( el != null ) {
            
                // find the position of our imgTitle
                if (el != null) {
                     t = findPos(el);
                     left = parseInt(t[0]);
                     top = parseInt(t[1]);
                }  
                else {
                    left = 100;  
                    top = 100; 
                }       
                
                // move the Floating tag layer relative to that
                left = left + 554;
                top = top + 30;
                left = String(left) + 'px';
                top = String(top) + 'px';
                
                // show the pic layer
                el2 = document.getElementById('divEng_Esp');
	            el2.style.left = left; 
	            el2.style.top = top;            
            }

}
       

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function PlayClip(ClipNo) {

    var el;
    var html;
    
    if ( ClipNo == '1' ) { html = '<a href="Flash/mockingbird.flv" style="display:block;width:281px;height:189px;" id="player"></a>' }
    if ( ClipNo == '2' ) { html = '<a href="Flash/SUPPORTERS.flv" style="display:block;width:281px;height:189px;" id="player"></a>' }
    if ( ClipNo == '3' ) { html = '<a href="Flash/UPTOWN_PARK.flv" style="display:block;width:281px;height:189px;" id="player"></a>' }
    if ( ClipNo == '4' ) { html = '<a href="Flash/westend.flv" style="display:block;width:281px;height:189px;" id="player"></a>' }
    
    // set the player    
    el = document.getElementById('divVideoPlayer');
    el.innerHTML = html;
    // call it 
    flowplayer("player", "Flash/flowplayer-3.1.1.swf");
    
}

var _htmlHold;

function ShowRegisterForm() {

    var el;
    var left,top,html,el2;
    var vid;
    
    // clear video player
    el = document.getElementById('divVideoPlayer');
    _htmlHold = el.innerHTML;
    el.innerHTML = '';
    
    // make sure the response box is not showing
    el2 = document.getElementById('divRegFormResponse');
    el2.style.left = '-1200px'; 
    
    // move the reg form
    el = FindMyControl('imgR1');
    if ( el != false ) {
    
        // find the position of our imgTitle
        if (el != null) {
             t = findPos(el);
             left = parseInt(t[0]);
             top = parseInt(t[1]);
        }  
        else {
            left = 100;  
            top = 100; 
        }       
        
        // move the Floating tag layer relative to that
        left = left + 284;
        top = top + 150;
        left = String(left) + 'px';
        top = String(top) + 'px';
        
        // show the pic layer
        el2 = document.getElementById('divRegForm');
        el2.style.left = left; 
        el2.style.top = top;            
    }

}

function ValidateRegistration() {

    var el;
    
    el = FindMyControl('txtFirstName');
    if ( el.value.length <= 1 ) { alert('A valid first name is required to register.  Please go back and provide a valid first name.'); return; }
    el = FindMyControl('txtLastName');
    if ( el.value.length <= 3 ) { alert('A valid last name is required to register.  Please go back and provide a valid last name.'); return; }
    el = FindMyControl('txtZipCode');
    if ( el.value.length <= 4 ) { alert('A valid zip code is required to register.  Please go back and provide a valid zip code.'); return; }
    el = FindMyControl('txtPhoneNumber');
    if ( el.value.length <= 9 ) { alert('A valid phone number is required to register.  Please go back and provide a valid phone number.'); return; }    
    el = FindMyControl('txtEmail');
    if ( el.value.indexOf('@') == -1 || el.value.indexOf('.') == -1 ) { alert('A valid email address is required to register.  Please go back and provide a valid email address.'); return; }        
    el = FindMyControl('chkRulesConsent');
    if ( el.checked == false ) { alert('You must consent to the above Contest Rules & Regulations by checking the check box just below the rules & regulations.'); return; }        
    
    el.form.submit();
}

function CancelRegistration() {

        var el2;
        el2 = document.getElementById('divRegForm');
        el2.style.left = '-1200px'; 
        
        // reset video player
        el = document.getElementById('divVideoPlayer');
        el.innerHTML = _htmlHold;
        
}

function CancelResponse() {

        var el2;
        el2 = document.getElementById('divRegFormResponse');
        el2.style.left = '-1200px'; 
        
}

function ShowRegisterResponse() {

    var el;
    var left,top,html,el2;
    
    // move the reg form
    el = FindMyControl('imgR1');
    if ( el != false ) {
    
        // find the position of our imgTitle
        if (el != null) {
             t = findPos(el);
             left = parseInt(t[0]);
             top = parseInt(t[1]);
        }  
        else {
            left = 100;  
            top = 100; 
        }       
        
        // move the Floating tag layer relative to that
        left = left + 284;
        top = top + 250;
        left = String(left) + 'px';
        top = String(top) + 'px';
        
        // show the pic layer
        el2 = document.getElementById('divRegFormResponse');
        el2.style.left = left; 
        el2.style.top = top;            
    }

}

function PlayYouTubeClip(ClipNum) {

    var html;
    var el;
    
    if ( ClipNum == '1' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/uqjKKbzKmNk&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/uqjKKbzKmNk&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    if ( ClipNum == '2' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/piSbZZlRUG4&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/piSbZZlRUG4&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    if ( ClipNum == '3' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/qThrKnTq91g&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qThrKnTq91g&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    if ( ClipNum == '4' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/_ZE9lhXEj2I&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/_ZE9lhXEj2I&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    if ( ClipNum == '5' ) { html = '<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/ih5N0f5Miwk&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ih5N0f5Miwk&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>'; }
    if ( ClipNum == '6' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/R1iHdsLJoww&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/R1iHdsLJoww&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    if ( ClipNum == '7' ) { html = '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/mf7L13vUl8Q&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mf7L13vUl8Q&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>'; }
    
    // set video player
    el = document.getElementById('divVideoPlayer');
    el.innerHTML = html;
    
}
