/* DOM ready */
$(document).ready(function(){
	
	// Set up the navigation menu
	$('ul.sf-menu').supersubs({minWidth:10,maxWidth:100,extraWidth:1}).superfish();
	
	// Assign css width/height to specially classed elements
	$("div[class*='jq-width-']").each(function(){
		var dim_data = $(this).attr('class').match(/jq\-width\-(\d+)/);
		$(this).css('width',dim_data[1]+'px');
	});

	// Assign css width/height to specially classed elements
	$("div[class*='jq-height-']").each(function(){
		var dim_data = $(this).attr('class').match(/jq\-height\-(\d+)/);
		$(this).css('height',dim_data[1]+'px');
	});
	
	// Round up
	DD_roundies.addRule('.home-box h3','10px 10px 0 0',true);
	DD_roundies.addRule('.home-box-content','0 0 10px 10px',true); // breaks IE7 and IE8 if you use a background image
	
	$('#flash-header').flash({
		swf: '/flash/NEW_header.swf',
		width:750,
		height:208
	});
	
});

/* After images load */
$(window).load(function(){
	$('.row-1 .home-box-content').equalHeights();
	$('.row-2 .home-box-content').equalHeights();
});


/* Other functions */
function fun_char_left()
{
	var max_char		= 500
	var txtmes			= document.getElementById("mess")
	var char_left		= document.getElementById("char_left")	
	
	if (txtmes.value.length <= max_char)
	{	
		char_left.value		= max_char - txtmes.value.length		
	}
	else
	{
		var new_str 		 = txtmes.value.slice(0,max_char) 
		txtmes.value		 = ""
		txtmes.value		 = new_str
		char_left.value		 = max_char - txtmes.value.length		
		alert("Error : Please Enter Less Or Equal To "+ max_char +" Characters.")

	}
}

function word_cnt(w,x)
{
var y = w.value;
var r = 0;
a=y.replace('\n',' ');
a=a.split(' ');
for (z=0; z<a.length; z++) 
{
  if (a[z].length >0) 
    r++;
}
x.value=r;
if(x.value > 20)
  w.value = w.value.substring(0, w.value.length-2);
}

function CreateBookmarkLink() {

	title = "Beyond.net Console";
	url = "http://www.dakcs.com/beyondconsole.html";

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}