// jsEffects.js


// 00. 
//------------------------------------------------------------------------------------------

window.onresize = toggleBloglink;
window.onload = function(){
	toggleBloglink('true')
}


// 01. toggleInputbox
//------------------------------------------------------------------------------------------

function toggleInputbox(id,text){

	var obj = document.getElementById(id);
	if(obj.value == text){
		obj.value = "";
	}else if(trim(obj.value) == ""){
		obj.value = text;
	}else{
		obj.value = trim(obj.value);
	}
	
}


// 02. trim
//------------------------------------------------------------------------------------------

function trim(str) {
	str = str.replace(/^\s+/, '');
	for (var i = str.length - 1; i >= 0; i--) {
		if (/\S/.test(str.charAt(i))) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return str;
}


// 03. toggleBloglink
//------------------------------------------------------------------------------------------

function toggleBloglink(obj){
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	}else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	var calcWidth = myWidth
	if(calcWidth > 990){
		$("#curlmark").fadeIn("normal");
	}else{
		if(obj == 'true'){
			document.getElementById("curlmark").style.display = "none";
		}else{
			$("#curlmark").fadeOut("normal");
		}
	}

}


// 04. showManualSelect
//------------------------------------------------------------------------------------------

function showManualSelect(){

	if(document.getElementById('select_subject').style.display == "block"){
		$("#select_subject").slideUp();
	}else{
		$("#select_subject").slideDown();
	}
}


// 05. toggleManualSelectCurrent
//------------------------------------------------------------------------------------------

function toggleManualSelectCurrent(value,text){
	
	document.getElementById('select_subject_current').innerHTML = text;
	document.getElementById('subject').value = value;
	$("#select_subject").slideUp();
	
}


// 06. tooltips
//------------------------------------------------------------------------------------------

$(function() {
	$('#sidetab_navigation a').tooltip({ 
		track: true, 
		delay:0,
		showURL: false
	}); 
});
