﻿// JScript File

// For Default Page
function opensurvey()
	{
		if ("<%=showSurvey %>" == "true")
		{
			window.open("~/survey/TalkToUs.aspx","contact_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=490,x=10,y=50,top=100,left=190");
		}
	}
	
function goSurvey()
    {
	    window.open("../survey/TalkToUs.aspx","survey_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=490,x=10,y=50,top=100,left=120");
    }

function goPlay(x)
    {
	    var urlBase="../play/Quiz.aspx";
	    var theURL;

	    if(x=="london")
	        {
		        theURL=urlBase + "?city=london";
	        }
	    else if(x=="paris") 
	        {
		        theURL=urlBase + "?city=paris";
	        }
	    else if(x=="rome")
	        {
		        theURL=urlBase + "?city=rome";
	        }
	    else if(x==undefined)
	        {
		        theURL=urlBase;
	        }
        window.open(theURL,"play_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=500,x=30,y=50,top=100,left=190");
    }

function goSee()
    {
	    window.open("../see/Videos.aspx","see_window","target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=490,x=10,y=50,top=100,left=190");
    }

function goHear(x)
    {
     var urlBase="../Hear/EFTourCast.aspx";
     var theURL;
      if(x=="london")
          {
                theURL=urlBase + "?Country=London";
          }
      else if(x=="paris")
        {
             theURL=urlBase + "?Country=Paris";
        }
      else if(x=="rome")
        {
            theURL=urlBase + "?Country=Rome";
        }
      else if(x=="barcelona")
        {
             theURL=urlBase + "?Country=Barcelona";
        }
     else if(x=="scotland") 
        {
             theURL=urlBase + "?Country=Scotland";
        }
      else if(x==undefined)
        {
             theURL=urlBase;
        }
     window.open(theURL,"hear_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=680,height=500,x=10,y=50,top=100,left=190");
}

function goConnect()
    {
	    window.open("../connect/IdeaView.aspx","connect_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=725,height=520,x=10,y=50,top=100,left=190");
    }

function goSendtoFriend()
    {
	    window.open("../sendtofriends/SendAEmail.aspx","connect_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=320,height=490,x=10,y=50,top=100,left=190");
    }

function goContact()
    {
	    window.open("../survey/TalkToUs.aspx","contact_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=490,x=10,y=50,top=100,left=190");
    }

function opensurvey()
	{
		if ("<%=showSurvey %>" == "true")
		{
			window.open("../survey/TalkToUs.aspx","contact_window", "target=new,toolbar=0,location=no,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=490,x=10,y=50,top=100,left=190");
		}
	}
//For Video pages

function openLoginWindow(theurl)
{
    var newWin = window.open("","_blank","status=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=yes,resizable=yes");
	newWin.location.href=theurl;
	newWin.focus();
}
function openSquareWin(theurl)
{
    var newWin = window.open("","printWin","height=687,width=1000,left=10,top=10,status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no");
	newWin.location.href=theurl;
	newWin.focus();
}
function openflash(theurl)
{
var newWin = window.open("","_blank","height=687,width=1000,left=10,top=10,status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no");
	newWin.location.href=theurl;
	newWin.focus();
}

//Gl video
function openLoginWindow(theurl)
{
    var newWin = window.open("","_blank","status=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=yes,resizable=yes");
	newWin.location.href=theurl;
	newWin.focus();
}
function openSquareWin(theurl)
{
    var newWin = window.open("","printWin","height=687,width=1000,left=10,top=10,status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no");
	newWin.location.href=theurl;
	newWin.focus();
}
function openflash(theurl)
{
var newWin = window.open("","_blank","height=687,width=1000,left=10,top=10,status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no");
	newWin.location.href=theurl;
	newWin.focus();
}

function openflash(theurl)
{
var newWin = window.open("","_blank","height=687,width=1000,left=10,top=10,status=yes,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no");
	newWin.location.href=theurl;
	newWin.focus();
}

function OpenPopup(url,width,height,left,top,resizeable,scrollbar)
{
var mywindow = window.open(url, "FAQ", "width="+width+",height="+height+",left="+left+",top="+top+",resizable="+resizeable+",scrollbars="+scrollbar+"");
mywindow.focus();
}

/*For send email section*/
    function empty(control)
        {
            if (control.cleared==null)
            {
                control.value = "";
                control.cleared = true;
            }
        }  


/*for photos */
  var num=0
    var SlideShow = true 
    var timeDelay
    var image=new Array()

    var imagePreload=new Array()
    for (i=0;i<image.length;i++)
    {
       imagePreload[i]=new Image()
       imagePreload[i].src=image[i]
    }
    

    function LoadPhotoSlide()
    {
        document.getElementById("PhotoSlide").src = image[0]
    }
    
    function image_effects()
    {
          if (document.all && document.getElementById("PhotoSlide"))
           {
               document.getElementById("PhotoSlide").filters.revealTrans.Transition=12
               document.getElementById("PhotoSlide").filters.revealTrans.apply()
               document.getElementById("PhotoSlide").filters.revealTrans.play()
           }
    }
    
    function Playfn()
    {
        if(document.getElementById("PlayBtn").name == "Play")
        {
             slideshow_automatic()
             document.getElementById("PlayBtn").name = "Pause"
             document.getElementById("PlayBtn").src = "../../Images/Parents/See/bnt_pause.gif"
             
        }
        else
        {
            document.images.PhotoSlide.src = image[num]
            clearTimeout(timeDelay)
            document.getElementById("PlayBtn").name = "Play"
            document.getElementById("PlayBtn").src = "../../Images/Parents/See/bnt_play.gif"
         }
        
    }
    
    function previous_image()
    {  
        clearTimeout(timeDelay)
        document.getElementById("PlayBtn").name = "Play"
        document.getElementById("PlayBtn").src = "../../Images/Parents/See/bnt_play.gif"
        if (num>0)
        {
           num--
           image_effects()
           document.images.PhotoSlide.src=image[num] 
         }
        if (num==0)
        {  
           //num=image.length
           //num--
           image_effects()
           //document.images.PhotoSlide.src=image[num] 
           document.location.href = "Photos.aspx?Continent=<%=continent%>&Country=<%= prevCountry%>"
        } 
   }


    function next_image()
    { 
        clearTimeout(timeDelay)
        document.getElementById("PlayBtn").name = "Play"
        document.getElementById("PlayBtn").src = "../../Images/Parents/See/bnt_play.gif"
        
        if (num<image.length)
        {
           num++
           //if last image is reached,display the first image
           if (num==image.length) 
                document.location.href = "Photos.aspx?Continent=<%=continent%>&Country=<%= nextCountry%>"
           image_effects()
           document.images.PhotoSlide.src=image[num]   
        }
     }
     
     function slideshow_automatic()
     { 
         if (num<image.length)
         {
           num++
           if (num==image.length) 
           {
             
              document.location.href = "Photos.aspx?Continent=<%=continent%>&Country=<%= nextCountry%>"
              //  num=0
           }
           else
           {
               image_effects()
               timeDelay=setTimeout("slideshow_automatic()",5000) 
               document.images.PhotoSlide.src = image[num]   
           }
         }
     }  
        
    // TO Hear Page
    
function openLoginWindow(theurl)
    {
        var newWin = window.open("","_blank","status=yes,toolbar=yes,menubar=yes,scrollbars=yes,location=yes,resizable=yes");
	    newWin.location.href=theurl;
	    newWin.focus();
    }
    
       
    /*For Idea share page*/   
       var charCount = 1500
function updateCount()
{
    charCount = 1500 - document.getElementById("TxtResponse").value.length
    if(document.getElementById("TxtResponse").value.length > 1500)
           document.getElementById("TxtResponse").value =  document.getElementById("TxtResponse").value.substring(0,1500)
    if(charCount >=0) 
        document.getElementById("CharCount").innerHTML = charCount
} 

      
