function sendLink(op) {
	tt=document.getElementById('forward');
	frommail=document.getElementById('forward-mail').value;
	fromname=document.getElementById('forward-name').value;
	tomail=document.getElementById('forward-fmail').value;
	switch (op) {
		case "open":
			if (window.innerWidth) {
				tt.style.left=(window.innerWidth-650)/2+"px";
			} else {
				tt.style.left=document.body.offsetLeft+20+"px";
			}
			tt.style.top=document.documentElement.scrollTop+20+"px";
			tt.style.display="block";
			break;
		case "close":
			document.getElementById('firststage').style.display='';
			document.getElementById('fault').style.display='none';
			document.getElementById('success').style.display='none';
			tt.style.display="none";
			break;
		case "send":
			action="remotecall.php";
			data=new Object();
			data['request']='mail';
			data['to']=tomail;
			data['mailfrom']=frommail;
			data['namefrom']=fromname;
			data['mailid']="602";
			data['field1']=document.location.href;
			tt.style.cursor="wait";
	 		resp=HTTPPost(action,false,null,data);
			tt.style.cursor="default";
			if (resp==1) {
				document.getElementById('firststage').style.display='none';
				document.getElementById('success').innerHTML=document.getElementById('success').innerHTML.replace("{friendsemail}",tomail);
				document.getElementById('success').style.display='block';
			} else {
				document.getElementById('firststage').style.display='none';
				document.getElementById('fault').innerHTML=document.getElementById('success').innerHTML.replace("{friendsemail}",tomail);
				document.getElementById('fault').style.display='block';
			}
			break;
	}
}
var lastOpened;
function showHide3Select(sender) {
	if (lastOpened && lastOpened!=sender) {
		document.getElementById('cselect_'+lastOpened).className='cselect';
		lastOpened=null;
	}
	sselects=document.getElementById('cselect_'+sender);
	if (sselects.className=='cselect') {
		sselects.className='cselect opened';
		document.getElementById('scrolled_'+sender).style.width=Math.max(sselects.clientWidth,document.getElementById('scrolled_'+sender).clientWidth)+"px";
		lastOpened=sender;
	} else {
		sselects.className='cselect'
	}
}

function bookmarksite(title, url){
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
function setAsHome() {

}
// href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://dynamicdrive.com');">Click here to make Dynamic Drive your default homepage</a>
function count_link() {
	HTTPGet("/directory/cl.php?id="+this.id);
	return true;
}
function validateLogin() {
	frm=document.getElementById("user-login-form");
	if (frm.elements['edit-name'].value && frm.elements['edit-pass'].value) {
		return true;
	} else {
		alert ('Both username and password fields have to be entered');
		return false;
	}
}
function  postCommentCheck() {
	forma=document.getElementById("comment_form");
	nname=forma.elements['edit-name'];
	mmail=forma.elements['edit-mail'];
	namemailOK=true;
	if (nname) {
//		namemailOK=(nname.value.length>3 && mmail.value.length>5);
		namemailOK=(nname.value.length && mmail.value.length);
	}
	try {
		content=tinyMCE.getContent();
	} catch (err) {
		content=document.getElementById("edit-comment").value;
	}
	if (content.length && namemailOK) {
		return true;
	} else {
		alert("Some required fields are empty.\nPlease fill all the required fields to add a comment.");
		return false;
	}
}
function showCommentForm(hide) {
	tt=document.getElementById("floated-comment-form");
	if (!tt) return false;
	if (hide) {
		tt.style.display='none';
	} else {
		if (window.innerWidth) {
			tt.style.left=(window.innerWidth-650)/2+"px";
		} else {
			tt.style.left=document.body.offsetLeft+20+"px";
		}
		tt.style.top=document.documentElement.scrollTop+20+"px";
		tt.style.display='block';
	}
}
function restoreEmails(){
	var rt=document.getElementsByTagName('A');
	var cc=rt.length;
	for (i=20; i<cc; i++) {
		if(rt[i].id != '') {
			rt[i].onclick = count_link;
		}
		if (rt[i].href.indexOf("::-::")>0) {
			rt[i].href=rt[i].href.replace("::-::","@");
		}
	}
}
function CheckEmail(Email) {

	hasDot = Email.indexOf(".");
	hasAt = Email.indexOf("@");

	if (hasDot == -1 || hasAt == -1) {
		alert("Please enter a valid email address.");
		return false;
	}
	return true;
}
function subscribeToHunter() {
	email1=document.getElementById('hunterEmail').value;
	if (CheckEmail(email1)) {
		action="remotecall.php";
		data=new Object();
 		data['action']="http://www.specialbonus.org/sendmaster/users/form.php?FormID=87";
 		data['FormCode']="1c7707d2e39ba6f977af95d85ee84fcc";
 		data['Format']="2";
		data['SelectLists[32]']="YES";
		data['request']='bonushunter';
		data['Email']=email1;
 		tt=HTTPPost(action,false,null,data)
		if (tt) {
			//document.getElementById('hunterForm').innerHTML='Thank you for your subscription';
			document.getElementById('hunterForm').innerHTML=tt;
			//setTimeout('document.getElementById("hunterForm").parentNode.parentNode.style.display="none"',5000);
		};
	}
}
function clickButton(which) {
	if (which=document.getElementById(which)) {
		which.click();
	}
}
function runnewsmarquee() {
	i=0;
	tt=document.getElementById('block-views-news_block');
/*	if (tt) {
		content = getElementsBySelector(tt, '.content')[0];
		list = tt.getElementsByTagName('UL')[0];
		content.innerHTML = '';
		var marq = document.createElement('MARQUEE');
		marq.id = 'newsmarquee';
		marq.appendChild(list);
		content.appendChild(marq);
		marq = document.getElementById('newsmarquee')
		marq.onmouseover='this.stop()';
		marq.onmouseout='this.start()';
		marq.direction='up';
		marq.scrolldelay='30';
		marq.scrollamount='1';
		marq.start();
	}*/
}
function showBigImage(sender) {
	if (document.getElementById('bigimage')) {
		tt=document.getElementById('bigimage');
		if (tt.style.display=='block') {
			tt.style.display='none';
			tt.removeChild(document.getElementById("BIImg"));
			tt.removeChild(document.getElementById("BITitle"));
			tt.innerHTML="";
		} else {
			title_=document.createElement("DIV");
			title_.id="BITitle";
			title_.innerHTML=sender.previousSibling.innerHTML;
			abutton="";
			if (sender.getAttribute("buttonData")) {
				abutton=sender.getAttribute("buttonData").split("|");
				abutton="<table border='0' cellspacing='0' cellpadding='0' class='red-button' style='margin:0;float:right;'><tr><td class='red-button-left'></td><td class='red-button-center'><a href='"+abutton[1]+"' target='"+abutton[3]+"' title='"+abutton[2]+"'>"+abutton[0]+"</a></td><td class='red-button-right'></td></tr></table>";
			}
			aclose="<div style='text-align:center;cursor:pointer; color:#0044BE;text-decoration:underline;' onclick='showBigImage(false)'>Close</div>";

			tt.innerHTML=abutton;
			tt.appendChild(title_);
			ttt=document.createElement('IMG');
			ttt.src=sender.src.replace("thub.","");
			ttt.id="BIImg";
			tt.appendChild(ttt);
			if (window.innerWidth) {
				tt.style.left=(window.innerWidth-650)/2+"px";
			} else {
				tt.style.left=document.body.offsetLeft+20+"px";
			}
			tt.innerHTML=tt.innerHTML+aclose;
			tt.style.top=document.documentElement.scrollTop+20+"px";
			tt.style.display='block';

		}
	}
}
function showHideComment(sender) {
	if (sender.parentNode.className=="comment unfolded") {
		sender.parentNode.className="comment";
		sender.nextSibling.style.display='none';
	} else {
		sender.parentNode.className="comment unfolded";
		sender.nextSibling.style.display='block';
	}
}
//DRAGGING
function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }
}

function setAsHomepage()
{
	f=document.getElementById("setashome-icon");
	if ( navigator.appVersion.indexOf('MSIE') != -1) {
		f.style.behavior='url(#default#homepage)'; f.setHomePage('http://www.casinosviplounge.com');
	} else {
		location.href='/doc/startpage.html'
	}
}

function leftMenuAccordion() {
//  var menus = document.getElementById('sidebar-left').getElementsByClassName('block-menu');
  var menus = document.getElementsByClassName('block-menu');
  addClass(menus[0],'activeblock');
  for (i=0;i<menus.length;i++) {
    if (menus[i].parentNode.id!='sidebar-left') continue;
    menus[i].firstChild.onclick = function() {
      for (j=0;j<menus.length;j++) { removeClass(menus[j],'activeblock') };
      if (!hasClass(this.parentNode,'activeblock')) addClass(this.parentNode, 'activeblock');
      else removeClass(this.parentNode, 'activeblock');
    }
  }
}



// if (isFP) addLoadEvent(leftMenuAccordion);
addLoadEvent(runnewsmarquee);
addLoadEvent(restoreEmails);
addLoadEvent(resizefunc);
addLoadEvent(function(){
	tt = document.getElementsByClassName('go-play');
	for (i=0;i<tt.length;i++) {
		tt[i].innerHTML = '<span>'+tt[i].innerHTML+'</span>';
	}
	
	document.getElementById('topmenu').getElementsByTagName('LI')[0].id='home';
	aaa = document.getElementById('topmenu').getElementsByTagName('A');
	for (i=0;i<aaa.length;i++) {
			if (aaa[i].href.toLowerCase()==document.location.href.toLowerCase()) {
					aaa[i].parentNode.className = aaa[i].parentNode.className + ' hover';
			}
	}
	lili = document.getElementById('topmenu').getElementsByTagName('LI');
	for (i=0;i<lili.length;i++) {
		if (lili[i].className.indexOf('hover')>0) {
			lili[i].parentNode.parentNode.className += ' hover';
		}
	}
	
	
});



function getViewportScrollY() {
  var scrollY = 0;
  if( document.documentElement && document.documentElement.scrollTop ) {
    scrollY = document.documentElement.scrollTop;
  }
  else if( document.body && document.body.scrollTop ) {
    scrollY = document.body.scrollTop;
  }
  else if( window.pageYOffset ) {
    scrollY = window.pageYOffset;
  }
  else if( window.scrollY ) {
    scrollY = window.scrollY;
  }
  return scrollY;
};

function scrollfunc() {
	if ($('floatpopup')) { $('floatpopup').style.marginTop = getViewportScrollY() + "px"; }
}

function resizefunc() {
	if (!$('floatpopup')) return;
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if (myWidth < 1024) $('floatpopup').style.display = 'none';
	else $('floatpopup').style.display = 'block';
}

document.getElementsByClassName = function(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
};
