
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>blog</title>
<base href='{echo:$siteDomain;/}' />
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/iframe.css">
<script type='text/javascript' src='servtools/calendar.js'></script>
	
<script type="text/javascript" charset="utf-8">
function $(id_value){
	return document.getElementById(id_value);
}

function initIntro() {
	var introObj = $('intropoll');
	var tipObj = $('addtip');
	if(introObj.style.display == 'none') {
		introObj.style.display = '';
		tipObj.innerHTML = "{echo:lp{pol_hidden_info};/}";
	} else {
		if (($('message').value.length == 0) || (confirm("{echo:lp{pol_a_hidden};/}"))) {
			introObj.style.display = 'none';
			$('message').value = '';
			tipObj.innerHTML = "{echo:lp{pol_add_info};/}";
		}
	}
}

function initReward(status) {
	var rewardObj = $('rewardlist');
	if(status == 1) {
		rewardObj.style.display = '';
	} else {
		rewardObj.style.display = 'none';
		$("credit").value = '';
		$("percredit").value = '';
	}
}

function showMoreOption() {
	$("moreoption").style.display = '';
	$("moretip").style.display = 'none';
}

function check_form(obj){
	var subj=$("subject").value;
	if(subj.length<1||subj.length>80){
		parent.Dialog.alert("{echo:lp{pol_limit_sub};/}");
		return false;
	}
	
	var optionCount = 0;
	var optionObj = document.getElementsByName("option[]");
	for(var i=0;i<optionObj.length;i++) {
		if(optionObj[i].value.replace(/[\s\n\r]/g,"")!="") {
			optionCount++;
		}
	}
	if(optionCount<2) {
		parent.Dialog.alert('{echo:lp{pol_w_option};/}');
		return false;
	}
	
if($("credit").value){
	if(isNaN($("credit").value)){
		parent.Dialog.alert('{echo:lp{pol_award_num};/}');return false;
	}
	if(parseInt($("credit").value)>{echo:$user_info['integral'];/}||parseInt($("credit").value)<1){
		parent.Dialog.alert('{echo:lp{pol_total_range};/}1~{echo:$user_info["integral"];/}');return false;
	}
	if($("percredit").value==''){
		parent.Dialog.alert('{echo:lp{pol_per_range};/}1~'+Math.min(parseInt($("credit").value),10));return false;
	}
	if(isNaN($("percredit").value)){
		parent.Dialog.alert('{echo:lp{pol_award_num};/}');return false;
	}
	if(parseInt($("percredit").value)>10||parseInt($("percredit").value) > parseInt($("credit").value)||parseInt($("percredit").value) < 1){
		parent.Dialog.alert('{echo:lp{pol_per_range};/}1~'+Math.min(parseInt($("credit").value),10));return false;
	}
}
	var makefeed = $("makefeed");
	if(makefeed) {
		if(makefeed.checked == false) {
			return window.confirm('{echo:lp{pol_w_affair};/}');
		}
	}
}
function get_min(){
	if(isNaN($('credit').value)){
		alert('{echo:lp{pol_award_num};/}');
	}else{
		$("m_point").innerHTML="{echo:lp{pol_per_range};/}1~"+Math.min(parseInt($('credit').value),10);
	}
}
</script>
</head>
<body id="iframecontent">
<div class="create_button"><a href="javascript:;" onclick="location.href='modules.php?app=poll_send'">{echo:lp{pol_send};/}</a></div>
<h2 class="app_vote">{echo:lp{pol_title};/}</h2>
<div class="tabs">
	<ul class="menu">
        <li><a href="modules.php?app=poll_list&m=new" hidefocus="true">{echo:lp{pol_new};/}</a></li>
        <li><a href="modules.php?app=poll_list&m=hot" hidefocus="true">{echo:lp{pol_hot};/}</a></li>
        <li><a href="modules.php?app=poll_list&m=reward" hidefocus="true">{echo:lp{pol_reward};/}</a></li>
        <li><a href="modules.php?app=poll_mine" hidefocus="true">{echo:lp{pol_mine};/}</a></li>
    </ul>
</div>
<div class="photo_view_box">
	<div class="photo_view_content">	
	
<form id="addnewpoll" name="addnewpoll" method="post" action="do.php?act=poll_add" onsubmit='return check_form(this);' autocomplete='off'>
<table class="form_table">
	<tr>
		<th height="38">{echo:lp{pol_sub};/}</td>
		<td>
			<input class="small-text" type="text" id="subject" name="subject" value="">
			<a id="addtip" href="javascript:;" onclick="initIntro();" onfocus="this.blur();">{echo:lp{pol_add_info};/}</a>
		</td>
	</tr>
	<tr id="intropoll" style="display:none">
		<th valign="top">{echo:lp{pol_more_info};/}</td>
		<td valign="top"><textarea id="message" class="textarea" name="message"></textarea> </td>
	</tr>
	<tr><td colspan="2" height="8"></td></tr>
	{echo:poll_item(1);/}
	<tr>
		<td></td>
		<td>
			<div><a id="moretip" href="javascript:void(0);" onclick="showMoreOption();" onfocus="this.blur();">{echo:lp{pol_add_m_option};/}</a></div>
		</td>
	</tr>
	<tbody id="moreoption" style="display: none;">
		{echo:poll_item(11);/}
	</tbody>
	<tr>
		<th>{echo:lp{pol_p_option};/}</td>
		<td>
			{echo:poll_select();/}
		</td>
	</tr>
	<tr>
		<th>{echo:lp{pol_over_time};/}</td>
		<td>
			<input class="small-text" type="text" size="16" id="expiration" readonly name="expiration" value="{echo:date("Y-m-d",time()+60*60*24*30);/}" onclick='calendar(this);' />
		</td>
	</tr>
	<tr>
		<th>{echo:lp{pol_limit};/}</td>
		<td>
			<input type="radio" name="sex" value="2" checked />{echo:lp{pol_no_limit};/}
			<input type="radio" name="sex" value="1" />{echo:lp{pol_man};/}
			<input type="radio" name="sex" value="0" />{echo:lp{pol_woman};/}
		</td>
	</tr>
	<tr>
		<th>{echo:lp{pol_com_limit};/}</td>
		<td>
			<input type="radio" name="noreply" value="0" checked />{echo:lp{pol_no_limit};/}
			<input type="radio" name="noreply" value="1" />{echo:lp{pol_only_fri};/}
		</td>
	</tr>
	<tr>
		<th>{echo:lp{pol_award};/}</td>
		<td>
			<input type="radio" name="reward" value="0" checked onclick="initReward(this.value);" />{echo:lp{pol_no};/}
			<input type="radio" name="reward" value="1" onclick="initReward(this.value);" />{echo:lp{pol_yes};/}
		</td>
	</tr>
	<tbody id="rewardlist" style="display: none;">
		<tr>
			<th>{echo:lp{pol_a_total};/}</td>
			<td>
				<input type="text" class="SmallInput" size="5" id="credit" name="credit" value="" maxlength="5" onblur='get_min();'>
				{echo:str_replace("{max_p}",$user_info['integral'],$pol_langpackage->pol_r_point);/}
			</td>
		</tr>
		<tr>
			<th>{echo:lp{pol_per_award};/}</td>
			<td>
				<input type="text" size="5" id="percredit" name="percredit" value="" maxlength="5">
				<span id='m_point'></span>
			</td>
		</tr>
	</tbody>
	<tr><th>{echo:lp{pol_aff_o};/}</td><td><input type="checkbox"  name="makefeed" id="makefeed" value="1" checked>{echo:lp{pol_affair};/}</td></tr>	
	<tr><td></td><td><input class="regular-btn" style="border: 0;" type="submit" name="action" value="{echo:lp{pol_con};/}" /></td></tr>
</table>
</form>
    </div></div>
</body>
</html>