// jump menu
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function addBookmark(title,url){
if(window.sidebar){
window.sidebar.addPanel("Bingo Power - online bingo and no deposit bingo", "http://www.bingopower.co.uk", "");
} else if(document.all){
window.external.AddFavorite("http://www.bingopower.co.uk","Bingo Power - online bingo and no deposit bingo");
} else if(window.opera && window.print){
alert('Sorry, your browser does not support this feature. Please click Ctrl+D to bookmark Bingo Power');
} else if(window.chrome){
alert('Sorry, your browser does not support this feature. Please click Ctrl+D to bookmark Bingo Power');
}
} 
 
 
// opens a popup window 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// submits a form to a popup window
function openTarget (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}
 
// sets the text of a text field. Include onclick="MM_setTextOfTextfield('email','','')" value="Enter Email" in the text field code
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}

// menu hover function for hover disabled browsers
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// word count function for jquery
$(document).ready(function() {
    $('.word_count').each(function() {
        var input = '#' + this.id;
        var count = input + '_count';
        $(count).show();
        word_count(input, count);
        $(this).keyup(function() { word_count(input, count) });
    });
});
function word_count(field, count) {
    var number = 0;
    var matches = $(field).val().match(/\b/g);
    if(matches) {
        number = matches.length/2;
    }
    $(count).text( number + ' word' + (number != 1 ? 's' : '') + ' approx');

}

//function for the star rating when the text hovers with the rating.
$(function(){
 $('.hover-star').rating({
  focus: function(value, link){
    // 'this' is the hidden form element holding the current value
    // 'value' is the value selected
    // 'element' points to the link element that received the click.
    var tip = $('#hover-test');
    tip[0].data = tip[0].data || tip.html();
    tip.html(link.title || 'value: '+value);
  },
  blur: function(value, link){
    var tip = $('#hover-test');
    $('#hover-test').html(tip[0].data || '');
  }
 });
});
