$(function(){
	
$(".header_menu").mouseover(function(){
	if ($(this).attr('id')== 'social_post_memu') {
		$('#social_post_memu').qtip('show');
	}
	if ($(this).attr('name') == 'on') {
		return;
	}
	img_src = $(this).attr('src');
	$(this).attr('src', img_src.replace('_off', '_on'));
});

$(".header_menu").mouseout(function(){
/*
	$('#social_post_memu').qtip('hide');
*/
	if ($(this).attr('name') == 'on') {
		return;
	}
	img_src = $(this).attr('src');
	$(this).attr('src', img_src.replace('_on', '_off'));
});


$(".static_menu").mouseover(function(){
	if ($(this).attr('name') == 'ons') {
		return;
	}
	img_src = $(this).attr('src');
	$(this).attr('src', img_src.replace('.png', '_on.png'));
});

$(".static_menu").mouseout(function(){
	if ($(this).attr('name') == 'ons') {
		return;
	}
	img_src = $(this).attr('src');
	$(this).attr('src', img_src.replace('_on', ''));
});


});



function mkQtip() {

	$('#social_post_memu').qtip({
		content: "カンタン設定で<br />RTを増やそう！",
		position: {
			corner: {
				tooltip: 'bottomMiddle',
				target: 'topMiddle'
			}
		},
		show: {
			when: false,
			delay: 0,
			ready: false,
			effect: {
				length:0,
				type:'none'
			}
		},
		hide: {
			delay: 0,
			effect: {
				length:0,
				type:'none'
			}
		},
		hide: false,
		style: {
			border: {
				width: 5,
				radius: 10,
				color: '#33CCFF'
			},
			color: 'white',
			fontWeight: 'bold',
			backgroundColor: '#33CCFF',
			padding: 10,
			textAlign: 'center',
			tip: true
		}
	});
	
}

/*
$(function () {
	mkQtip();
    if (! $.browser.safari) {
        $('#link_to_top').click(function () {
            $(this).blur();
            $('html,body').animate({ scrollTop: 0 }, 'fast');
            return false;
        });
    }
});
*/

function go_back_to_x(mode) {
	var obj_form = document.getElementById("main_form");
	var obj_mode = document.getElementById("mode");
	obj_mode.value = mode;
	obj_form.submit();
}

function disableBtn($target) {
	var ev = window.event;
	if(ev && ev.type == 'keypress' && ev.keyCode != 13) {
		return false;
	}
	$target.disabled = true;
	if ($target.form) {
		$target.form.submit();
	}
}
/*
window.onload = externalLinks;
*/
function showPopup(url, width, height) {
	if (width == null) {
		width = 650;
	}
	if (height == null) {
		height = 600;
	}
	var mywindow = window.open(url,'_blank','scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);
	mywindow.focus();
	if(mywindow.opener == null){
		mywindow.opener = self;
	}
}

function setDate(input_date, form_id, date_prefix) {
    var form = document.getElementById(form_id);
    var year_name = date_prefix + 'Year';
    var month_name = date_prefix + 'Month';
    var day_name = date_prefix + 'Day';
    input_date = input_date.split("-");
    form[year_name].value = input_date[0];
    if (input_date[1].length == 1) {
        input_date[1] = '0' + input_date[1];
    }
    form[month_name].value = input_date[1];
    form[day_name].value = input_date[2];
}
function link_change(link_name, newlink) {
	$(link_name).attr('href', newlink);
	
}
function change_tab(active_tab, nonactive_tab) {
	$(active_tab).css('display', 'block');
	$(nonactive_tab).css('display', 'none');

	active_tab_tab = active_tab + '_tab';
	nonactive_tab_tab = nonactive_tab + '_tab';

	img_active_tab_tab = $(active_tab_tab).attr('src');
	img_nonactive_tab_tab = $(nonactive_tab_tab).attr('src');

	new_img_active_tab_tab = img_active_tab_tab.replace('_off', '_on');
	new_img_nonactive_tab_tab = img_nonactive_tab_tab.replace('_on', '_off');

	$(active_tab_tab).attr('src', new_img_active_tab_tab);
	$(nonactive_tab_tab).attr('src', new_img_nonactive_tab_tab);
}

function bookmark(type, url, title) {
	
	var profiles =
	{
		window400:
		{
			height:400,
			width:400,
			status:1
		}
	};

	$(".popupwindow").popupwindow(profiles);

	switch(type) {
	case 'hatena':
		break;
	}
}

