var ispoup;

//Specify settings for EMAIL WINK popup div tag display mode. 3 possible values are:
var displaymode="always"
var enablefade="no" //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["no", 5] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="yes" //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength=1 //fade in duration for IE, in seconds
var Mozfadedegree=0.2 //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)
if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)
//End of settings for the popup

// Start of Centered Pop-Up Div Tags for Chat, Winks, request

//############################################################################
function loading(div)
{	
	var str="<center><table width=\"140\" height=\"100\" ><tr><td valign=\"middle\" align=\"center\" class=\"Red11Bold\"><img src='/images/loading.gif'  border='0' /> <br> Loading . . . <br><a href='' onclick='top.hidefadebox();return false; '> Cancel </a> </td></tr></table> </center>";
	writeLayer(str,div);	
}


function fadeinboxpopup(url)
{	
	
	var myAjax = new Ajax.Updater('fadeinbox_content', url, {method: 'get',evalScripts: true	});
	writeLayer("<center><table width=\"140\" height=\"100\" ><tr><td valign=\"middle\" align=\"center\" class=\"Red11Bold\"><img src='http://dailytalent.com/images/loading.gif'  border='0' /> <br> Loading . . . <br><br> <a href='#' onclick='javascript:top.hidefadebox();return false;'>Cancel</a> </td></tr></table> </center>","fadeinbox_content");	
	

	var ie=document.all && !window.opera
	var dom=document.getElementById
	iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox
	var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
	var docwidth=(ie)? iebody.clientWidth : window.innerWidth
	docheight=(ie)? iebody.clientHeight: window.innerHeight
	var objwidth=objref.offsetWidth
	objheight=objref.offsetHeight
	objref.style.left=docwidth/2-objwidth/2+"px"
	objref.style.top=scroll_top+docheight/2-objheight/2+"px"

	if (showonscroll=="yes")
	showonscrollvar=setInterval("staticfadebox()", 50)

	if (enablefade=="yes" && objref.filters){
	objref.filters[0].duration=IEfadelength
	objref.filters[0].Apply()
	objref.filters[0].Play()
	}
	objref.style.visibility="visible"
	if (objref.style.MozOpacity){
	if (enablefade=="yes")
	mozfadevar=setInterval("mozfadefx()", 90)
	else{
	objref.style.MozOpacity=1
	controlledhidebox()
	}
	}
	else
	controlledhidebox()
}
//############################################################################


function staticfadebox(){
var ie=document.all && !window.opera
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
objref.style.top=scroll_top+docheight/2-objheight/2+"px"
}

function hidefadebox(){
objref.style.visibility="hidden"
if (typeof showonscrollvar!="undefined")
clearInterval(showonscrollvar)
}

function controlledhidebox(){
if (autohidebox[0]=="yes"){
var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
setTimeout("hidefadebox()", delayvar)
}
}


function initfunction(){
//setTimeout("emaildivpopup()", 100)
//setTimeout("nudgedivpopup()", 100)
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}


if (displaymode=="oncepersession" && get_cookie("fadedin")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){
if (window.addEventListener)
window.addEventListener("load", initfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", initfunction)
else if (document.getElementById)
window.onload=initfunction
document.cookie="fadedin=yes"
}


//==============================================================================

function mozfadefx(){
if (parseFloat(objref.style.MozOpacity)<1)
objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
else{
clearInterval(mozfadevar)
controlledhidebox()
}
}


// Start of Centered Pop-Up Window 
function popupwindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
// END of centered Pop-Up Window 

////////////============================================================================
////////////============================================================================
function displayShowInfo(ShowID,event)
{
	
	writeLayer("{WaitingInfo}","showTagInfo");
	new Ajax.Updater({ success: "showTagInfo", failure: 'notice'	 }, 'playlist_infotag.php?ShowID='+ShowID, { method: 'get',evalScripts:true });
	 var lyr = getElemRefs("showTagInfo");
	 lyr.style.left=115;
	 window.status=event.screenY;
	 lyr.style.top=event.pageY;
	showLayer("showTagInfo");

}

function checkForm(frm, arr_ctrl) {
	var count= arr_ctrl.length ;
	var i=0  ;
	for(i=0; i< count; i++) {
		func= trim( arr_ctrl[i][0] ) ;
		//alert(func);
		if( eval( func ) ) { //== 
			alert( arr_ctrl[i][1] ) ;
			if( arr_ctrl[i][2] != "" )
				eval( "frm."  + arr_ctrl[i][2] ).focus() ;
			return false ; //== Error
		}
	}
	return true ; //== OK
}

function isEmail(s)
{
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/) != -1)
            return true ;
        else
            return false ;
    
}
function trim(str) {
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isNegative(str) {
	if( isNaN(str) || str <= 0 )
		return true ;
	return false ;
}
function isLeapYear( yyyy ) {
	if( ( yyyy%4==0 && yyyy % 100 !=0 ) || yyyy%400==0 )
		return true ;
	return false ;
}

function isBlank(str) {
	if( str == "" ) 
		return true ;
	return false ;
}
function isValidDate(dd, mm, yyyy){ 
	//alert(dd);
	if(dd<=0 || dd>31 ||  mm>12 || mm<1)
		return false;
    if (( mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30 ){         
        return false; 
    } else if ( mm == 2 && dd > 29 ) {
        return false; 
    } else if (mm == 2 && ! isLeapYear(yyyy) && dd > 28){ 
        return false; 
    }else if(yyyy<1800)
		return false;
	return true;
}//isValidDate 

function  not_entered(input,default_val)
{

	if(isBlank(input)  ||	input==default_val)
		return true;
	return false;
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function	writeLayer(text,id)
{
	
	if (document.getElementById)
	{
		x = document.getElementById(id);
		
		if(x=="undefined" || x==null)
		{
			alert("can not find layer "+id);
			return;
		}
		x.innerHTML = '';
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="testclass">' + text + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}
//get the value of selected item in listbox
function get_listbox_selected(obj)
{
	
	for (i=0;i<obj.length;i++)
	{
		
		if(obj[i].selected)
			return obj[i].value
	}
	
	return "";
}


function hilight(obj)
{
//EFCFA5
obj.bgColor="#F4F4F4";
}
function no_hilight(obj)
{
	obj.bgColor="";
}


function hilight1(obj)
{
//EFCFA5
obj.bgColor="#D1CEC5";
}
function no_hilight1(obj)
{
	obj.bgColor="#ffffff";
}



function change_img(img_name,src)
{
	document.images[""+img_name+""].src=src;
}

function showTreeLayer(id) {

  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideTreeLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}
function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

//--------------------------------------------------------------------------------------------
function hilight_color(obj,color)
{
	
	obj.bgColor=color;
}
//--------------------------------------------------------------------------------------------

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
//----------------------------------------------------------------------------------------------------------------
Array.prototype.in_array = function ( obj ) {
	var len = this.length;
	for ( var x = 0 ; x <= len ; x++ ) {
		if ( this[x] == obj ) return true;
	}
	return false;
}

//-----------------------------------------------------------
//below function is for Admin Button3_rollover CSS button

function goLite(FRM,BTN)
{
   if(isObject(FRM))
	{
		 FRM.style.color = "#ffffff";
		 FRM.style.backgroundColor = "#990000";
		 FRM.style.borderStyle = "ridge";
		 FRM.style.borderColor = "#c9966e";
	}else
	{
	   window.document.forms[FRM].elements[BTN].style.color = "#000000";
	   window.document.forms[FRM].elements[BTN].style.backgroundColor = "#000000";
	   window.document.forms[FRM].elements[BTN].style.borderStyle = "ridge";
	   window.document.forms[FRM].elements[BTN].style.borderColor = "#000000";
	}
}

function goDim(FRM,BTN)
{
	if(isObject(FRM))
	{
		 FRM.style.color = "";
		 FRM.style.backgroundColor = "";
		 FRM.style.borderStyle = "";
		 FRM.style.borderColor = "";
	}else
	{
	   window.document.forms[FRM].elements[BTN].style.color = "#000000";
	   window.document.forms[FRM].elements[BTN].style.backgroundColor = "";
	   window.document.forms[FRM].elements[BTN].style.borderStyle = "";
	   window.document.forms[FRM].elements[BTN].style.borderColor = "#000000";
	}
}

function showHideTreeLayer(id) {

  var lyr = getElemRefs(id);
  if (lyr && lyr.css) 
  if (lyr.css.display == "none")
  {
	  lyr.css.display = "block";
  }else
  lyr.css.display = "none";
}


function isObject(o) {return (o && "object" == typeof o) || isFunction(o);}
function isFunction(o) {return "function" == typeof o;}



<!--
<!--function clickIE() {if (document.all) {(message);return false;}}
<!--function clickNS(e) {if 
<!--(document.layers||(document.getElementById&&!document.all)) {
<!--if (e.which==2||e.which==3) {(message);return false;}}}
<!--if (document.layers) 
<!--{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
<!--else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

<!--document.oncontextmenu=new Function("return false")



 