var items=new Array();
var option_count=-1;
var form_url="";
var form_id="";


function uniworld__form_import_item(itemname,price,discount,introduce,selected,input_string,input,input_unit,qty)
{
	option_count+=1;
	items[option_count]=new Array(itemname,price,discount,introduce,selected,input_string,input,input_unit,qty);
}


function uniworld__black_background(html)
{
	var Height_e
	var width=document.body.clientWidth;
	if(document.documentElement.scrollHeight<window.screen.availHeight)
	{
		Height_e=window.screen.availHeight;
	}
	else
	{
		Height_e=document.documentElement.scrollHeight;		
	}
	
	$("#PopDiv01").css("position","absolute");
	$("#PopDiv01").css("left","0px");
	$("#PopDiv01").css("width",width+"px");
	$("#PopDiv01").css("height",Height_e+"px");
	$("#PopDiv01").css("top","0px");
	$("#PopDiv01").css("background-color","#000000");
	$("#PopDiv01").css("filter","alpha(opacity=60)");
	$("#PopDiv01").css("-moz-opacity","0.5");
	$("#PopDiv01").css("z-index","99");
	$("#PopDiv01").css("display","");
	
//	$("#plus_description").css("filter","Alpha(opacity=80)");
//	$("#plus_description").css("-moz-opacity",".8");
	$("#PopDiv01").css("opacity","0.5");
	
	$("#PopDiv02").css("z-index","100");
	$("#PopDiv02").css("position","absolute");
	$("#PopDiv02").css("top",(parseInt(document.documentElement.scrollTop)+50)+"px");
	$("#PopDiv02").css("left","0px");
	$("#PopDiv02").css("width",width+"px");
	//$("#PopDiv02").css("height",Height_e+"px");
	//$("#PopDiv02").css("color","#fff");
	$("#PopDiv02").css("display","");
	//html_string_inner='<div id="PopDiv02" style="position:absolute; left:; :; :'+width+'; z-index:100;">111</div>';
	
	$("#PopDiv02").html('<div style="width:960px; margin:0 auto;">'+html+'</div>');
}


function uniworld__form_display()
{
	var html='';
	var i=0;

	
	for(i=0;i<items.length;i++)
	{	
		html+='<div class="items">';
		html+='<ul class="items_head">';
		html+='<li class="left-1">'+items[i][0]+'</li>';
		html+='<li class="right-1">';

		if(items[i][7]!="")
		{
			html+='<a class="no-support" href="javascript:uniworld__selected('+i+')" id="support_id_'+i+'">报名</a>';
		}
		else
		{
			html+='<a class="no-support" href="javascript:uniworld__selected('+i+')" id="support_id_'+i+'">赞助</a>';
		}
		html+='</li>';
		
		if(items[i][6]==1)
		{
		html+='<li class="right-1">';
		html+=items[i][5]+'<input name="textfield" type="text" id="qty_'+i+'" value="1" size="5" />'+items[i][7];
		html+='</li>';
		}
		
		html+='</ul>';
		html+='<ul class="items_body">';
		html+='<li>';
		html+='<h3>全价:'+items[i][1]+'元</h3>';
		//html+='<h3>折扣价:'+items[i][2]+'元</h3>';
		html+='</li>';		
		html+='<li>';
		html+=items[i][3];
		html+='</li>';
		html+='</ul>';
		html+='</div>';  
	}	
	
	html+='<div id="PopDiv01"></div><div id="PopDiv02"></div>';
	
	document.write(html); 
}


function uniworld__selected(id)
{
	//alert(id);
	if(items[id][4]==1)
	{
		items[id][4]=0;
		document.getElementById("support_id_"+id).className="no-support";
	}
	else
	{
		items[id][4]=1;
		document.getElementById("support_id_"+id).className="support";
	}
	
	uniworld__confirm();
}


function uniworld__confirm_close()
{
	$("#PopDiv02").css("display","none");
	$("#PopDiv01").css("display","none");
}


function uniworld__confirm()
{
	var html="";
	var i;
	var ii=0;
	var total_price=0;
	
	var sponsor_fee="";
		
	
	html+='<div class="head">';
	
	html+="<h2>提交已选中的表单</h2>";
	
	html+='<a class="close_button" href="javascript:uniworld__confirm_close();" style="display:block;background-image:url(http://www.chinacivilaviation.com/GAForum/Template/upload/file/2010-2-3/button-3.jpg);height:20px;width:50px;overflow:hidden;color:#000;padding:3px 0 0 30px;background-position:0 23px;color:#fff;float:right;margin:10px;">关闭</a>';
	
	html+="</div>"
	
	html+='<div class="price_list">';
	
	html+="<h3>(4月30日以前报名参会和赞助可获得折扣优惠,请把握机会!)</h3>";
	
	
	html+='<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">';
	
	html+='<tr>';
	html+='<td class="bold">赞助项目</td>';
	html+='<td class="bold">全价</td>';
	//html+='<td class="bold">折扣价</td>';
	html+='</tr>';
	
	for (i=0;i<items.length;i++)
	{
		if(items[i][4]==1)
		{
			if(items[i][6]==1)
			{				
				html+='<tr>';
				html+='<td width="300">'+items[i][0]+'('+parseInt($("#qty_"+i).val())+items[i][7]+')</td>';
				html+='<td>'+parseInt(items[i][1])*parseInt($("#qty_"+i).val())+'元</td>';
				//html+='<td>'+parseInt(items[i][2])*parseInt($("#qty_"+i).val())+'元</td>';
				html+='</tr>';
				
				total_price+=parseInt(items[i][1])*parseInt($("#qty_"+i).val());
			
				sponsor_fee+='赞助项目: '+items[i][0]+'('+parseInt($("#qty_"+i).val())+items[i][7]+')<br>';
				sponsor_fee+='全价: '+parseInt(items[i][1])*parseInt($("#qty_"+i).val())+"元<br>";
				//sponsor_fee+='折扣价: '+parseInt(items[i][2])*parseInt($("#qty_"+i).val())+"元<br>";
				
			}
			else
			{
				html+='<tr>';
				html+='<td width="300">'+items[i][0]+'</td>';
				html+='<td>'+items[i][1]+'元</td>';
				//html+='<td>'+items[i][2]+'元</td>';
				html+='</tr>';
				
				total_price+=parseInt(items[i][1]);
			
				sponsor_fee+='赞助项目: '+items[i][0]+"<br>";
				sponsor_fee+='全价: '+items[i][1]+"<br>";
				//sponsor_fee+='折扣价: '+items[i][2]+"<br>";
			}
			ii+=1;
			
			
		}
	}
	
	if (ii==0)
	{
		alert("请先选择选赞助项目!");
		return;
	}
	
	sponsor_fee+='总价: '+total_price+' 元';
	
	html+='<tr>';
    html+='<td colspan="3" align="right">总价: '+total_price+' 元 </td>';
	html+='</tr>';
	
	html+='</table>';
	
	
	html+='<form id="form1" name="form1" method="post" action="'+form_url+'">';
	html+='<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="gray_border">';
	
	
	html+='<tr>';
	html+='<td width="150" align="right">公司:</td>';
	html+='<td align="left">';
	html+='<input type="text" name="company_name" id="textfield" />';
	html+='</td>';
	html+='</tr>';
	
	
	html+='<tr>';
	html+='<td width="150" align="right">姓名:</td>';
	html+='<td align="left">';
	html+='<input type="text" name="user_name" id="textfield" />';
	html+='</td>';
	html+='</tr>';
	
	html+='<tr>';
	html+='<td width="150" align="right">邮件:</td>';
	html+='<td align="left">';
	html+='<input type="text" name="email" id="textfield" />';
	html+='</td>';
	html+='</tr>';
	
	html+='<tr>';
	html+='<td width="150" align="right">电话:</td>';
	html+='<td align="left">';
	html+='<input type="text" name="tel" id="textfield" />';
	html+='</td>';
	html+='</tr>';
	
	html+='<tr>';
	html+='<td width="150" align="right">地址:</td>';
	html+='<td align="left">';
	html+='<input type="text" name="address" id="textfield" />';
	html+='</td>';
	html+='</tr>';
	
	html+='<tr>';
	html+='<td width="150" align="right" valign="top">服务或产品:</td>';
	html+='<td align="left">';
	html+='<textarea name="message" id="textarea" cols="45" rows="5"></textarea>';
	html+='</td>';
	html+='</tr>';
	
	html+='<tr>';
	html+='<td colspan="2" align="center">';
	html+='<input type="hidden" name="sponsorfee" id="sponsorfee" value="sponsor'+sponsor_fee+'"/>';
	html+='<input type="hidden" name="category_id" id="category_id" value="'+form_id+'">';
	html+='<input type="submit" name="button" id="button" value="提交" class="submit"/>';
	html+='</td>';
	html+='</tr>';
	html+='</table>';
	html+='</form>';
	
	html+='</div>';
	
	
	
	
	uniworld__black_background('<div class="confirm_form">'+html+'</div>')

}


function uniworld__submit()
{
	if (!inputed)
	{
		return;
	}
	
				
}
