function connection_failed() {
	alert('متاسفانه خطایی در ارتباط رخ داده است ');
}
function textarea(t) {
	a = t.value.split('\n');
	b = 1;
	for (x = 0; x < a.length; x++) {
		if (a[x].length >= t.cols)
			b += Math.floor(a[x].length / t.cols);
		if (a[x].length < t.cols)
			b -= Math.floor(a[x].length / t.cols);
	}
	b += a.length;
	if (b < 10)
		b = 10;
	t.rows = b;
}
var gen = function(type) {
	if (type == "pre")
		document.getElementById("content-title").innerHTML = '&nbsp;<h5><img src="./images/gen_pre.png" class="menu_img"> دانلود اشتراکی </h5>';
	if (type == "free")
		document.getElementById("content-title").innerHTML = '&nbsp;<h5><img src="./images/free-download.png" class="menu_img"> <font color="red"> دانلود رایگان </font></h5>';
	var htmlcontent = '<form action="javascript:loaddataform(\'gen\',\'\',\'\',\'gen_form\',\'cp\');" name="gen_form" id="gen_form">';
	htmlcontent += '<input type="hidden" name="gen_type" value="' + type + '"/><p align="center"><textarea name="url" onkeyup="textarea(this);"  rows="10" cols="65" dir="ltr" ></textarea><br/><br/>';
	htmlcontent += '<input type="image" src="images/save.png" alt="تبدیل لینک"/></p></form><div id="free_message"></div>';
	document.getElementById("div-main").innerHTML = htmlcontent;
	if (type == "free")
		loaddata('cpanel/free','free_message');
}
function init() {
	YAHOO.util.Dom.setStyle("graph", "display", "block");
}
YAHOO.util.Event.onDOMReady(init);
