		var g_phone_type = '';
		var g_phone_name = '';
		var g_manu_name = '';

		function popPhone(userPhone,callback,event){	
			if (jQuery('#xsnazzy_new').length > 0){
				//$("#bluephone").html(userPhone);
				//$("#xsnazzy_new").toggle();
				//return;
				$("#xsnazzy_new").remove();
			}
			
			var divText = '<div id="xsnazzy_new" style="display:none"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>';
			divText += '<div class="xboxcontent"><div class="pname">';
			divText += '<span><a href=#><img onclick=\'$("#xsnazzy_new").toggle();\' src="http://img.mms.sohu.com/m/msite/popphone/images/close.gif" /></a></span>请选择您使用的手机：';
			divText += '<strong id="bluephone" class="blue1">'+userPhone+'</strong></div>';
			divText += '<div class="poptit"><span>手机品牌</span><span>手机型号</span></div>';
			divText += '<div class="popleft"><ul id="mycarouselphone" class="jcarousel jcarousel-skin-pop"></ul></div><div class="pright"></div><div style="clear:both" ></div></div>';
			divText += '<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>';
			
			$(document).find('body').append(divText);
			$("#xsnazzy_new").css('position','absolute');
			var left = event.clientX+15+$("#xsnazzy_new").width();
			if (left > window.document.body.offsetWidth){
				left = window.document.body.offsetWidth - $("#xsnazzy_new").width() -15;
				if (left <0) left = 0;
			}
			else{
				left = event.clientX+15;
			}
			$("#xsnazzy_new").css('left',left);
			$("#xsnazzy_new").css('top',event.clientY+5);
			$("#xsnazzy_new").css('z-index',1000);
			
			$("#xsnazzy_new").toggle();
			jQuery('#mycarouselphone').jcarousel({
				vertical: true,
				visible: 8,
				scroll:	7,
				size: pop_itemList.length,
				itemLoadCallback: {onBeforeAnimation: pop_itemLoadCallback}
			});

			pclick_callback = function(phone_type,phone_name,manu_name){
				$("#xsnazzy_new").toggle();
				callback(g_phone_type,g_phone_name,g_manu_name);
			};		
			
			
		}

		function popJiHuo(userPhone,callback,event){	
			if (jQuery('#xsnazzy_new').length > 0){
				//$("#bluephone").html(userPhone);
				//$("#xsnazzy_new").toggle();
				//return;
				$("#xsnazzy_new").remove();
			}
						
			var divText = '<div id="xsnazzy_new" style="display:none"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>';
			divText += '<div class="xboxcontent"><div class="pname">';
			divText += '<span><a href=#><img onclick=\'$("#xsnazzy_new").toggle();\' src="http://img.mms.sohu.com/m/msite/popphone/images/close.gif" /></a></span>请选择您使用的手机：';
			divText += '<strong id="bluephone" class="blue1">'+userPhone+'</strong></div>';
			divText += '<div class="activet">为了给您提供更多的个性化服务，请激活手机玩家频道</div>';
			divText += '<div class="activec"><p>我的昵称：<input type="text" name="nickname" size="20" /><span> </span></p>';
			divText += '<p>手机型号：<strong class="blue1" id="bluephone1">请选择您的手机品牌和型号</strong>  <a href="javascript:void(0)" id="popmodifyphone"></a></p></div>';
			divText += '<div class="poptit"><span>手机品牌</span><span>手机型号</span></div>';
			divText += '<div id="popleftul"><div class="popleft" ><ul id="mycarouselphone" class="jcarousel jcarousel-skin-pop"></ul></div><div class="pright"></div></div>';
			divText += '<div class="activebtm"><div class="tp_p" ><input name="tysohuxy" type="checkbox" value="1" checked />同意搜狐手机玩家频道<span class="blue1"><a href="http://m.sohu.com/copyright.html" target=”_blank”>用户协议</a></span></div>';
			divText += '<img src="http://img.mms.sohu.com/m/msite/popphone/images/btn_jh.gif" /></div><div style="clear:both" ></div></div>';
			divText += '<b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div>';
			
			$(document).find('body').append(divText);
			$("#xsnazzy_new").css('position','absolute');
			if (event != ''){
				var left = event.clientX+15+$("#xsnazzy_new").width();
				if (left > window.document.body.offsetWidth-20){
					left = window.document.body.offsetWidth - $("#xsnazzy_new").width() -15;
					if (left <0) left = 10;
				}
				else{
					left = event.clientX+15;
				}
				$("#xsnazzy_new").css('left',left);
				$("#xsnazzy_new").css('top',event.clientY+5);
			}
			else{
				var left = window.document.body.offsetWidth - $("#xsnazzy_new").width();

				$("#xsnazzy_new").css('left',left/2);
				$("#xsnazzy_new").css('top',100);
			}
			
			$("#xsnazzy_new").css('z-index',1000);
			$("#xsnazzy_new").toggle();
		
			jQuery('#mycarouselphone').jcarousel({
				vertical: true,
				visible: 8,
				scroll:	7,
				size: pop_itemList.length,
				itemLoadCallback: {onBeforeAnimation: pop_itemLoadCallback}
			});
			$('.activebtm').find('img').css('cursor','pointer');
			$('.activebtm').find('img').click(function(){
				var nickname = $("input[name='nickname']").val();
				var tysohuxy = $("input[name='tysohuxy']").attr('checked');
			
				if (!tysohuxy){
					alert('您没有选择同意搜狐手机玩家频道用户协议!');
					return;
				}

				if (nickname == ''){
					alert('我的昵称不能为空!');
					return;
				}
				

				callback(g_phone_type,g_phone_name,g_manu_name,nickname);
			});

			$('#popmodifyphone').click(function(){
				$('#popleftul').fadeIn('slow');
				$('#popmodifyphone').html('');
			});

			pclick_callback = function(phone_type,phone_name,manu_name){
				$('#bluephone').html(manu_name+' '+phone_name);
				$('#bluephone1').html(manu_name+' '+phone_name);
				$('#popmodifyphone').html('修改机型');
				$('#popleftul').fadeOut("slow");
			};	
		}
 		
		var pid = ''
		var pclick_callback = function(phone_type,phone_name,manu_name){
			$('#bluephone').html(manu_name+' '+phone_name);
		};

		function showSendPhone(id,callback){	
			if (pid == '')
			{
				pid = '#'+id;
				pclick_callback = callback;
			}
			else{
				$(pid).toggle();
				return;
			}
			
								
			//var divText = '<div id="xsnazzy_new" style="height:auto!important;height:250px; border-bottom:1px dashed #d6e4f1;">'; 
			var divText = '<div class="poptit"><span>手机品牌</span><span>手机型号</span></div>';
			divText += '<div class="popleft"><ul id="mycarouselphone" class="jcarousel jcarousel-skin-pop"></ul></div><div class="pright"></div>';
			//divText += '</div>';
			
			
			$(pid).prepend(divText);
			//alert($(pid).html());
			//$(pid).toggle();
			jQuery('#mycarouselphone').jcarousel({
				vertical: true,
				visible: 8,
				scroll:	7,
				size: pop_itemList.length,
				itemLoadCallback: {onBeforeAnimation: pop_itemLoadCallback}
			});
		}

		function pop_itemLoadCallback(carousel, state)
		{
			for (var i = carousel.first; i <= carousel.last; i++) {
				if (carousel.has(i)) {
					continue;
				}

				if (i > pop_itemList.length) {
					break;
				}
								
				// Create an object from HTML
				var item = jQuery(mycarousel_getItemHTML(pop_itemList[i-1])).get(0);
				
				carousel.add(i, item);
			}

			jQuery('#mycarouselphone').find('li').css('cursor','pointer');
							
			jQuery('#mycarouselphone').find('li').mouseover(function(){
					$(this).css('text-decoration','underline');
				});

			jQuery('#mycarouselphone').find('li').mouseout(function(){
					$(this).css('text-decoration','none');	
				});

			jQuery('#mycarouselphone').find('li').each(function(i){
					$(this).click(function(){	
						$('#mycarouselphone').find('li').removeClass('popon');
						$(this).addClass('popon');
						g_manu_name = $(this).find('span').html();
						var manuid = $(this).find('span').attr('id').substring(3);
						load_phone_list(manuid);
					});
				});
		};
		/**
		 * Item html creation helper.
		 */
		function mycarousel_getItemHTML(item)
		{
			return '<span id="pop' + item.id + '" >' + item.title + ' </span>';
		};
		
		function load_phone_list(manuid){
			var httpUrl = "/msohuport/manusmall/"+manuid+"/1.html";
			var options={
									dataType:"text",
									type:"GET",
									url:httpUrl,
									data:'',
									success:function(txt){
											$('.pright').html(txt);						
											bind_phone_first_char_click();
									}									
								};
				$.ajax(options); 
		}
		
		var pre_u_id = ''; 

		function bind_phone_first_char_click(){
			$('.pright_t').find('span').css('cursor','pointer');
			$('.pright_t').find('span').click(function(){
				$('.pright_t').find('span').removeClass();
				$(this).addClass('prcolr');
				if (pre_u_id != ''){
					$(pre_u_id).hide();
				}				
				var u_id = "#p_"+$(this).html();
				pre_u_id = u_id;
				$(u_id).show();
				$(u_id).find('li').css('cursor','pointer');
				$(u_id).find('li').click(function(){
					g_phone_type = $(this).attr('id').substring(1);
					g_phone_name = $(this).html();
					pclick_callback(g_phone_type,g_phone_name,g_manu_name);
				});

				$(u_id).find('li').mouseover(function(){
					$(this).css('text-decoration','underline');
				});

				$(u_id).find('li').mouseout(function(){
					$(this).css('text-decoration','none');			
				});
			});

			$('.pright_t').find('span').mouseover(function(){
				$(this).css('text-decoration','underline');
			});

			$('.pright_t').find('span').mouseout(function(){
				$(this).css('text-decoration','none');			
			});
		}

		




					


