function check_search(){
if (document.getElementById("keyword").value == ""){
	alert("Please enter a keyword to search...");
	document.getElementById("keyword").select();
	return false;
	}
}

function play_DoFSCommand(command, args)
{
	var cookies = document.cookie;
	
	var start = cookies.indexOf(command + "=");

	start = cookies.indexOf("=",start)+1;
	
	var end = cookies.indexOf(";",start);
	if (end == -1){
		end = cookies.length;
	}
	
	var value = unescape(cookies.substring(start,end));

		if (value != "")
		{
			if(args == "on"){
				document.cookie = command+"=on";
			}
			else
			{
				document.cookie = command+"=off";
			}
		}
}

function ReadCookie(name,nextFla,flaWidth,flaHeight)
{
	var cookies = document.cookie;
	
	var start = cookies.indexOf(name + "=");

	start = cookies.indexOf("=",start)+1;
	
	var end = cookies.indexOf(";",start);
	if (end == -1){
		end = cookies.length;
	}
	
	var value = unescape(cookies.substring(start,end));

		if (value == "Set")
		{
			var elm = document.getElementById("play");
			for(var i=0;i<elm.childNodes.length;i++){
				if(elm.childNodes[i].name == "movie" || elm.childNodes[i].name == "src"){
					var flaValue = elm.childNodes[i].value;
					flaValue = flaValue.substr(0,flaValue.lastIndexOf("/")+1) + nextFla;
				}
			}
			var flashVars = ReadCookieFlashVars("music");
			var str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' id='play' width='"+flaWidth+"' height='"+flaHeight+"'>";
			str += "<param name='movie' value='" + flaValue + "'>";
			str += "<param name='quality' value='high'>";
			if (flashVars != ""){
				str += "<param name='FlashVars' value='key=" + flashVars + "'>";
			}
			str += "<param name='wmode' value='transparent'>";
			str += "<embed src='" + flaValue + "' quality='high' FlashVars='" + flashVars + "' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' id='play' width='"+flaWidth+"' height='"+flaHeight+"'></embed></object>";
			document.getElementById("fla").innerHTML=str;
		}
		else
		{
			document.cookie = name+"=Set";
			var flashVars = ReadCookieFlashVars("music");
		}
	//}
}

function ReadCookieFlashVars(name)
{
	var cookies = document.cookie;
	var start = cookies.indexOf(name + "=");

	if (start >=0)
	{
		start = cookies.indexOf("=",start)+1;
		var end = cookies.indexOf(";",start);
		if (end == -1){
			end = cookies.length;
		}
		var value = unescape(cookies.substring(start,end));
	}
	else
			value="";	

if (value=="")
{
		document.cookie = name+"=on";
		value="on"
	}
return value;

}

function getCookieFlash(name)
{
	var cookies = document.cookie;
	var start = cookies.indexOf(name + "=");

	if (start >=0)
	{
		start = cookies.indexOf("=",start)+1;
		var end = cookies.indexOf(";",start);
		if (end == -1){
			end = cookies.length;
		}
		var value = unescape(cookies.substring(start,end));
	}
	else
			value="";	

if (value=="")
{
		return false;
	}
return true;

}
//-------------------------------------IE7 Flash Fix------------------------//
AC_FL_RunContent = 0;


function CouponLogin(url,hiddenElmBgImage,selectElmBgImage){
	url=url+"?uid="+document.getElementById('txt_user').value+"&pwd="+document.getElementById('txt_Pwd').value;
	var XMLhttpObj = false;
    if (typeof XMLHttpRequest != 'undefined'){
        XMLhttpObj = new XMLHttpRequest();
    } else if (window.ActiveXObject){
        	try{
            	XMLhttpObj = new ActiveXObject('Msxml2.XMLHTTP');
        	} catch(e) {
            		try{
                		XMLhttpObj = new ActiveXObject('Microsoft.XMLHTTP');
            		} catch(e) {}
        	}
    }
    if (!XMLhttpObj) return;
	
	XMLhttpObj.onreadystatechange = function() {
    	if (XMLhttpObj.readyState == 4) { // when request is complete
    		if(XMLhttpObj.responseText=="Invalid User Name or Password")
    		{
    			document.getElementById("lblLoginMsg").innerHTML=XMLhttpObj.responseText;
    		}
    		else
    		{
    			location.href=XMLhttpObj.responseText;	
    		}
		}
    };
    url = url+"&sid="+Math.random();
    XMLhttpObj.open('GET', url, true);
    XMLhttpObj.send(null);
}

function getMainDivPosition(element){
		if(document.getElementById(element))
		{
		var elmDiv = document.getElementById(element);
		var x=0;var y=0;
		
		if(elmDiv.offsetParent){
      temp = elmDiv
     
      while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
        temp=temp.offsetParent; 
        x+=temp.offsetLeft
        y+=temp.offsetTop;
      }
    }
    //alert(x);
		//startTop = startTop + elmDiv.offsetTop - 11;
		startTop = startTop + y;
		startLeft = startLeft + x;
		//alert(startTop);
	}
	}
	
function viewFullScreenPopup(filename)
	{
 	   var mybars='width='+screen.availWidth +',height='+screen.availHeight+',directories=no,location=no,menubar=no,status=no,screenX=0,screenY=0';
 	   mybars+=',titlebar=no,toolbar=no';
	   myoptions='scrollbars=yes,resizeable=yes';
	   myfeatures=mybars+ ','+myoptions
	   var newwin=open(filename,'FullScreen',myfeatures);
	   newwin.opener=window;
	   newwin.focus();
	   return false;
    }   
    
    
function SendRequest(url,hiddenElmBgImage,selectElmBgImage){
	/*//alert(url);
	var XMLhttpObj = false;
    if (typeof XMLHttpRequest != 'undefined'){
        XMLhttpObj = new XMLHttpRequest();
    } else if (window.ActiveXObject){
        	try{
            	XMLhttpObj = new ActiveXObject('Msxml2.XMLHTTP');
        	} catch(e) {
            		try{
                		XMLhttpObj = new ActiveXObject('Microsoft.XMLHTTP');
            		} catch(e) {}
        	}
    }
    if (!XMLhttpObj) return;
	
	XMLhttpObj.onreadystatechange = function() {
    	if (XMLhttpObj.readyState == 4) { // when request is complete
    		//alert(XMLhttpObj.responseText);
    		if(XMLhttpObj.responseText=="timedout")
    		{
    		 //alert("Your login time has been expired. Please login again.");
    		 window.location.href="CourseLogin.aspx?msg=Login Time Expired";
    		}
		}
    };
    url = url+"?sid="+Math.random();
    XMLhttpObj.open('GET', url, true);
    XMLhttpObj.send(null);*/
}
function ObjButtonsCallBack()
{
	if(window.opener.document.getElementById("lnk_prev"))
		window.opener.document.getElementById("lnk_prev").style.display="block";
	if(window.opener.document.getElementById("lnk_next"))
		window.opener.document.getElementById("lnk_next").style.display="block";
	if(window.opener.document.getElementById("pnl_PageButtons"))
		window.opener.document.getElementById("pnl_PageButtons").style.display="block";
	if(window.opener.document.getElementById("pnl_QuizButtons"))
		window.opener.document.getElementById("pnl_QuizButtons").style.display="block";
	//if(document.getElementById("lnk_next"))
		window.close();
	//javascript:location.href('#buttonsPosition');
		
}
function enablePageButtons(status)
{

	if(window.opener.document.getElementById(status))
		window.opener.document.getElementById(status).style.display="block";
}
function hidePageQuizButtons()
{
	if(document.getElementById("btn_TakeQuiz"))
		document.getElementById("btn_TakeQuiz").style.display='none';
	if(document.getElementById("btn_FinalExam"))
		document.getElementById("btn_FinalExam").style.display='none';
	if(document.getElementById("btn_TryAgain"))
		document.getElementById("btn_TryAgain").style.display='none';
	if(document.getElementById("btn_TryAgainFinal"))
		document.getElementById("btn_TryAgainFinal").style.display='none';
}

