$(function(){

	$(".rolldownmenutable a:last").mouseover(function() {
    $(".rolldownmenu").slideDown("fast");
  });
	$(".rolldownmenutable").mouseleave(function() {
    $(".rolldownmenu").slideUp("fast");
  });
	
	$(".loginoutbox a:last").mouseover(function() {
    $(".loginrolldownmenu").slideDown("fast");
  });
	$(".loginoutbox").mouseleave(function() {
    $(".loginrolldownmenu").slideUp("fast");
  });
									   
	$(".sitemapoutbox").mouseover(function() {
    $(".sitemaprollmenu").fadeIn("fast");
  });
	$(".sitemapoutbox").mouseleave(function() {
    $(".sitemaprollmenu").fadeOut("fast");
  });
	
	$(".whatsonvideo").mouseover(function() {
    $(this).find(".whatsonvideo_caption").fadeIn("fast");
  });
	$(".whatsonvideo").mouseleave(function() {
    $(this).find(".whatsonvideo_caption").fadeOut("fast");
  });
	
});


$(document).ready(function() {

// assuming all checkboxes are unchecked at first
$("span[class='checkbox']").addClass("unchecked");





	$(".checkbox").click(function(){
		if($(this).children("input").attr("checked")){
			// uncheck
			$(this).children("input").attr({checked: ""});
			$(this).removeClass("checked");
			$(this).addClass("unchecked");
		}else{
			// check
			$(this).children("input").attr({checked: "checked"});
			$(this).removeClass("unchecked");
			$(this).addClass("checked");
		}

	});
	
	$("span[class='circlecheckbox']").addClass("circleunchecked");

	$(".circlecheckbox").click(function(){

		if($(this).children("input").attr("checked")){
			// uncheck
			$(this).children("input").attr({checked: ""});
			$(this).removeClass("circlechecked");
			$(this).addClass("circleunchecked");
			
		}else{
			// check
			$(this).children("input").attr({checked: "checked"});
			$(this).removeClass("circleunchecked");
			$(this).addClass("circlechecked");
		}

	});
	
	$("span[class='radiocheckbox']").addClass("radiounchecked");
	
	$(".radiocheckbox").live('click',function(){	

		if(!$(this).children("input").attr("checked")){
			// check
			$(this).parent().parent().find("input").attr({checked: ""});
			$(this).parent().parent().find(".radiocheckbox").removeClass("radiochecked");
			$(this).parent().parent().find(".radiocheckbox").addClass("radiounchecked");
			$(this).children("input").attr({checked: "checked"});
			$(this).removeClass("radiounchecked");
			$(this).addClass("radiochecked");
		}

	});
	
	$(".radiocheckbox").each(function(){

		if($(this).children("input").attr("checked")){
			// uncheck
			$(this).addClass("radiochecked");
		};

	});
	
	
	
});

$(document).ready(function() {
       		$('input[type="text"]').focus(function() {
    		    if (this.value == this.defaultValue){ 
    		    	this.value = '';
				}
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    		});
    		$('input[type="text"]').blur(function() {
    		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});
		});		

/* newly added 30oct */

$(function(){		 
$(".contentnavbox .cholla17").each(function(){
var pattern = /[^0-9a-z\s~!@#$%^&*()_+\-=|\\\[\]:;"'\/?.>,<`{}]+/gi;
var str = [$(this).html()];
var str2 = result = new Array();
var match = str[0].match(pattern);
var newstr = '';

for(i=0; i<match.length; i++){
	//console.log(match[i]);
	str[i+1] = str[i].slice(str[i].indexOf(match[i+1],1));
	//console.log(str[i]);
	if(i != match.length-1)
		str2[i] = str[i].substring(0, str[i].indexOf(match[i+1],1));
	else
		str2[i] = str[i].substring(0);
	//console.log(str2[i]);
	result[i] = str2[i].replace(match[i], '<font class="chi">' + match[i] + '</font>');
	//console.log(result[i]);
	newstr = newstr.concat(result[i]);
	//console.log(newstr);
}

$(this).html(newstr);
});
});
