$(function() {
		
	$("#notepaddialog").dialog( {
		autoOpen : false,
		bgiframe : true,
		position : [ 'right', 'bottom' ],
		width : 550

	});
	if($("#tabs").length>0)
		{
$("#tabs").tabs('select', parseInt(document.getElementById("navValue").value));
		}
	
	followTop();
	
	 $(window).resize(function() {
			followTop();
		 });
});




function followTop(){

$('#followTop').css('top', $(document).scrollTop());
if($('#test').length>0)
	{
$('#test').css('top', $(document).scrollTop() + $(window).height() - $('#test').height());
	}

}
$(window).scroll(followTop);





function loadnotepad() {
	$("#notepaddialog").html("<iframe width='510' height='460' frameborder='no' border='0' marginwidth='0' marginheight='0' scrolling='no' src='../user/notepad.jsp'></iframe>");

	$("#notepaddialog").dialog("open");
}

function toQzoneLogin() {
	var accessor = {
		consumerSecret : "c7018f1a717d4b6452fc5ef0d53ab716",
		tokenSecret : ""
	};
	var message = {
		method : "GET",
		action : "http://openapi.qzone.qq.com/oauth/qzoneoauth_request_token",
		parameters : OAuth.decodeForm("")
	};

	var timestamp = OAuth.timestamp();
	message.parameters.push([ "oauth_timestamp", timestamp ]);
	var nonce = OAuth.nonce(11);
	message.parameters.push([ "oauth_nonce", nonce ]);
	message.parameters.push([ "oauth_consumer_key", "202507" ]);
	message.parameters.push([ "oauth_signature_method", "HMAC-SHA1" ]);

	message.parameters.push([ "oauth_version", "1.0" ]);

	OAuth.SignatureMethod.sign(message, accessor);

	var signValue = OAuth.getParameter(message.parameters,
			"oauth_signature");

	var ah = OAuth.getAuthorizationHeader("", message.parameters);

	var rUrl = "../oauthlogin.jsp?logintype=1&time=" + timestamp
			+ "&nonce=" + nonce + "&sign=" + encodeURIComponent(signValue);

	var A = window
			.open(
					rUrl,
					"TencentLogin",
					"width=450,height=320,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
	return false;
}

function ajax(url, p) {
	var xmlHttp = false;

	try {
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e2) {
			xmlHttp = false;
		}
	}

	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
		xmlHttp = new XMLHttpRequest();
	}

	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("cache-control", "no-cache");
	xmlHttp.setRequestHeader("Content-Type",
			"application/x-www-form-urlencoded");
	xmlHttp.send(p);

}

function replaceTextarea1(str) {
	var reg = new RegExp("\r\n", "g");
	var reg1 = new RegExp(" ", "g");

	str = str.replace(reg, "<br>");
	str = str.replace(reg1, "<p>");

	return str;
}

function replaceTextarea2(str) {
	var reg = new RegExp("<br>", "g");
	var reg1 = new RegExp("<p>", "g");

	str = str.replace(reg, "\r\n");
	str = str.replace(reg1, " ");

	return str;
}

