﻿function varcall( name )
{
	
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
  	return results[1];
}

var args = location.search.substr(1).split("?");



function returnIframe(chk)
{
	var invar = varcall('albumid');
	var invar = unescape(invar);
	if(chk){
		var url = "<iframe src='http://" + iframeID + ".iframe.mediak.com/?command=selectedalbum&album=" + invar + "' width='750' height='750' allowtransparency='true' frameborder='0'></iframe>";
	}
	else{
		var url = "<iframe src='http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + invar + "&_autopickprod=1' width='650' height='550' allowtransparency='true' frameborder='0'></iframe>";	
	}
	//alert(url);
	document.write(url);
}

function showinvar()
{
	var invar = varcall('albumid');
	var invar = unescape(invar);
	alert("<iframe src='http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + invar + "&_autopickprod=1' width='650' height='550' allowtransparency='true' frameborder='0'></iframe>");
}

function makewindow(source, num)
{
	var generator=window.open('','name','height=450,width=650');
	
	generator.document.write('<html><head><title>Mediak iFrame</title>');
  	generator.document.write('</head><body>');
  	generator.document.write('<iframe src="http://' + num + '.iframe.mediak.com/' + source + '" frameborder="0" allowtransparency="true" width="650" height="450"></iframe>');
  	generator.document.write('</body></html>');
}

function makewindow2(source, num)
{
	var generator=window.open('','name','height=600,width=650');
	
	generator.document.write('<html><head><title>Mediak iFrame</title>');
  	generator.document.write('</head><body>');
  	generator.document.write('<iframe src="http://' + num + '.iframe.mediak.com/' + source + '" frameborder="0" allowtransparency="true" width="625" height="575"></iframe>');
  	generator.document.write('</body></html>');
}

function makewindow3(source, num)
{
	document.write('<iframe src="http://' + num + '.iframe.mediak.com/' + source + '" frameborder="0" allowtransparency="true" width="625" height="575"></iframe>');
}

/*function makewindow3()
{
	alert("does work");
	var generator=window.open('','name','height=600,width=600');
	
	generator.document.write('<html><head><title>' + title + '</title>');
  	generator.document.write('</head><body>');
  	generator.document.write('<img src="' + url + '"/>');
  	generator.document.write('</body></html>');
}*/

function iframe()
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 610) / 2;
	var voffset = (height - 425) / 2;

	//var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1";	
	var url = "?_reset=1";
	makewindow(url, iframeID);
	//closeFlash();
	//window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
	
	
}

function iframe2(productID)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 610) / 2;
	var voffset = (height - 425) / 2;

	/*var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";*/	
	var url = "?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";
	makewindow(url, iframeID);
	//closeFlash();
	//my_window = window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
	//my_window.write(<title>Mediak iFrame</title>);
	//if(true == my_window.closed){ var flashMovie=getFlashMovieObject("myFlash"); flashMovie.GotoFrame(3);}
}

function iframe3(productID)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 610) / 2;
	var voffset = (height - 425) / 2;

	//var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_uimode_id=1";	
	var url = "?_reset=1&_uimode_id=1";
	makewindow(url, iframeID);
	//closeFlash();
	//window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
}

function iframe4(productID,video)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 610) / 2;
	var voffset = (height - 425) / 2;

	//var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + productID + "&_autopickprod=1";	
	var url = "?_reset=1&_products=" + productID + "&_autopickprod=1&_buylinks=";
	if(video == "yes"){
		makewindow2(url, iframeID);
	}
	else{
		makewindow(url, iframeID);
	}
	//closeFlash();
	//window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
}

function iframe5(productID, height, width)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 650) / 2;
	var voffset = (height - 600) / 2;

	/*var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";*/	
	var url = "?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";
	makewindow2(url, iframeID);
	//closeFlash();
	//my_window = window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
	//my_window.write(<title>Mediak iFrame</title>);
	//if(true == my_window.closed){ var flashMovie=getFlashMovieObject("myFlash"); flashMovie.GotoFrame(3);}
}

function iframe6(productID)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - 650) / 2;
	var voffset = (height - 600) / 2;

	/*var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";*/	
	var url = "?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";
	makewindow(url, iframeID);
	//closeFlash();
	//my_window = window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
	//my_window.write(<title>Mediak iFrame</title>);
	//if(true == my_window.closed){ var flashMovie=getFlashMovieObject("myFlash"); flashMovie.GotoFrame(3);}
}

function iframe7(productID)
{
	/*var url = "http://" + iframeID + ".iframe.mediak.com/?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3&_buylinks=";*/	
	var url = "?_reset=1&_products=" + productID + "&_autopickprod=1&_uimode_id=3";
	makewindow3(url, iframeID);
	//closeFlash();
	//my_window = window.open(url, 'lyrics', 'height=450,width=650,toolbar=no,scrollbars=yes,left=' + hoffset + ',top=' + voffset);
	//my_window.write(<title>Mediak iFrame</title>);
	//if(true == my_window.closed){ var flashMovie=getFlashMovieObject("myFlash"); flashMovie.GotoFrame(3);}
}

function santaMovie()
{
	var width = screen.width;
	var height = screen.height;
	var hoffset = (width - 740) / 2;
	var voffset = (height - 500) / 2;
	
	var url = "/images/html/santaMovie.html";
	
	window.open(url, 'lyrics', 'height=500,width=740,toolbar=no,scrollbars=no,left=' + hoffset + ',top=' + voffset);
}

function popupImage(url,w,h)
{
	var width = screen.width; 
	var height = screen.height;
	var hoffset = (width - w) / 2;
	var voffset = (height - h) / 2;	
	
	window.open(url, 'image', 'height=' + h + ',width=' + w + ',toolbar=no,scrollbars=no,left=' + hoffset + ',top=' + voffset);
}

function doPassVar1(args){
   var on0 = args.value.toUpperCase();
   window.document.myFlash.SetVariable("nameTxt", on0);
}
function doPassVar2(args){
   var os0 = args.value;
   window.document.myFlash.SetVariable("line1", os0);
}
function doPassVar3(args){
   var on1 = args.value;
   window.document.myFlash.SetVariable("line2", on1);
}
function doPassVar4(args){
   var os1 = args.value;
   window.document.myFlash.SetVariable("line3", os1);
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function playsound(albumid){
	moveWindow(albumid);
}

function closeFlash(){
	var flashMovie=getFlashMovieObject("myFlash");
	flashMovie.GotoFrame(3);
}

function playFlash(){
	var flashMovie=getFlashMovieObject("myFlash");
	flashMovie.Play();
}

function playsound1(albumid){
	//alert(albumid);
	var flashMovie=getFlashMovieObject("myFlash");
	var soundurl='#' + albumid;
	flashMovie.GotoFrame(3);
	window.document.myFlash.SetVariable("inAlbum", albumid);
	flashMovie.GotoFrame(0);
	flashMovie.GotoFrame(2);
	moveWindow(albumid);
}

function stopsound1(inurl){
	var flashMovie=getFlashMovieObject("myFlash");
	//alert(flashMovie.CurrentFrame());
	if(flashMovie.CurrentFrame() == 5){
		flashMovie.GotoFrame(0);
		flashMovie.Play();
	}
	else if(flashMovie.CurrentFrame() == 3){
		flashMovie.GotoFrame(4);
	}
	moveWindow(inurl);
}

function moveWindow(outurl,hash){
	//alert("back to top");
	if(hash == 'hash'){
		window.location.hash=outurl;
	}
	else{
		window.location=outurl;
	}
}

function stopsound(inurl, hash){
	moveWindow(inurl, hash);
}

function newWindow(inurl){
	//alert("new window");
	window.location=inurl;
}

function checkme1() {

	theValue = document.form1.selectName[ document.form1.selectName.selectedIndex ].value;
	
	if (theValue == "default")
		{
		alert("Please select a name.");
		return false;
		} 
		theValue2 = document.form1.on0.value;
		if (theValue2 == "") {
		alert("Please type the Correct spelling of the Child's Name in the field provided.");
		return false;
		} 
		return true;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  alert(selObj.selectedIndex);
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  if(selObj.selectedIndex==0){
	  var flashMovie=getFlashMovieObject("myFlash");
	  flashMovie.GotoFrame(2);
  }
  else if(selObj.selectedIndex==1){
	  var flashMovie=getFlashMovieObject("myFlash");
	  flashMovie.GotoFrame(2);
  }
  else if(selObj.selectedIndex==2){
	  var flashMovie=getFlashMovieObject("myFlash");
	  flashMovie.GotoFrame(2);
  }
  else if(selObj.selectedIndex==3){
	  var flashMovie=getFlashMovieObject("myFlash");
	  flashMovie.GotoFrame(4);
  }
}

function resume(){
	var flashMovie=getFlashMovieObject("myFlash");
	flashMovie.GotoFrame(3);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_jumpMenuGo(selObj,targ,restore){ //v3.0
  if (selObj) MM_jumpMenu(targ,selObj,restore);
}

var startY = 0;
var sy;

function floatMenu()
{
  if(document.documentElement.scrollTop)
  {
    sy = document.documentElement.scrollTop;
  }
  else
  {
    sy = document.body.scrollTop;
  }

  var temp = sy + startY;
  var newY = temp.toString() + "px";

  if(document.getElementById("menu")){
		var elem = document.getElementById("menu");
  		elem.style.top = newY;
  }
  
}

function flashObject(_p, _w, _h, _vers, _vars, _i){
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"\n");
	document.write(" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_vers+"\"\n");
	document.write(" id=\""+_i+"\" align=\"middle\" height=\""+_h+"\" width=\""+_w+"\">\n");
	document.write("<param name=\"FlashVars\" value=\""+_vars+"\"/>\n");
	document.write("<param name=\"allowScriptAccess\" value=\"always\"/>\n");
	document.write("<param name=\"movie\" value=\""+_p+"\"/>\n");
	document.write("<param name=\"quality\" value=\"high\"/>\n");
	document.write("<param name=\"scale\" value=\"exactfit\"/>\n");
	document.write("<param name=\"wmode\" value=\"transparent\"/>\n");
	document.write("<param name=\"bgcolor\" value=\"#ffffff\"/>\n");
	document.write("<param name=\"swLiveConnect\" value=\"true\"/>\n");
	document.write("<embed flashvars=\""+_vars+"\" src=\""+_p+"\" quality=\"high\"\n");
	document.write(" scale=\"exactfit\" wmode=\"transparent\" bgcolor=\"#ffffff\" name=\"\"\n");
	document.write(" allowscriptaccess=\"always\" type=\"application/x-shockwave-flash\"\n");
	document.write(" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"\n");
	document.write(" align=\"center\" height=\""+_h+"\" width=\""+_w+"\" swLiveConnect=\"true\">\n");
	document.write("</object>\n");
}

window.onscroll = floatMenu;

var check = "no";

	var current_res = "";
	var playing = "";
	
	function swapVideo(url, width, height)
	{
			
			flashembed("flashcontent", {
				src: '/images/video/FlowPlayerClassic.swf',
				width: width,
				height: height,
				align: 'middle'
			},
			{config: {
				videoFile:url,
				initialScale:'scale',
				showMenu: false, 
				controlsOverVideo: 'ease',
				controlBarBackgroundColor: -1,
				controlBarGloss: 'low'
			}});	
	}
   
   function showVideo(id){
	   	element = document.getElementById(id).style;
		//alert(id);
		if(id == "low"){
			current_res = "low";
			element.color = "#000000";
			element.textDecoration = "none";
			element.fontWeight = "bold";
		}
		else if(id != "low"){
			document.getElementById("low").style.color = "#000000";
			document.getElementById("low").style.textDecoration = "underline";
			document.getElementById("low").style.fontWeight = "normal";
		}
		if(id == "medium"){
			current_res = "medium";
			element.color = "#000000";
			element.textDecoration = "none";
			element.fontWeight = "bold";
		}
		else if(id != "medium"){
			document.getElementById("medium").style.color = "#000000";
			document.getElementById("medium").style.textDecoration = "underline";
			document.getElementById("medium").style.fontWeight = "normal";
		}
		if(id == "high"){
			current_res = "high";
			element.color = "#000000";
			element.textDecoration = "none";
			element.fontWeight = "bold";
		}
		else if(id != "high"){
			document.getElementById("high").style.color = "#000000";
			document.getElementById("high").style.textDecoration = "underline";
			document.getElementById("high").style.fontWeight = "normal";
		}
	}
	
	function playVideo(id){
		showVideo(id);
   		if(current_res == "low"){
			if(playing != "low"){
				lowVideo();
				playing = "low";
			}
		}
		else if(current_res == "medium"){
			if(playing != "medium"){
				mediumVideo();
				playing = "medium";
			}
		}
		else if(current_res == "high"){
			if(playing != "high"){
				highVideo();
				playing = "high";
			}
		}
	}
	
	function highVideo()
	{
		swapVideo('/images/video/loop_high_648x432.flv',576,432);
	}
	
	function mediumVideo()
	{
		swapVideo('/images/video/loop_medium_504x336.flv',448,336);
	}
	
	function lowVideo()
	{
		//alert("low video clicked");
		swapVideo('/images/video/loop_low_360x240.flv',320,240);
	}
	

