﻿function A_Login(){
	var a_urlstr="/ajax/checklogin.cfm";
	jQuery.ajax({
		url:a_urlstr,
		dataType:"json",
		error:function(x,s,e){/*alert(s);*/},		
		success:function(data){
			if(data != ''){				
				jQuery(data).each(function(i){
					var x = data[i];					
					if(x.IsLogIn.toUpperCase() == 'YES'){
						//alert(x.Consumption);
						jQuery('#CurUserName').replaceWith(x.CurUserName);
						jQuery('#jifen').replaceWith(parseFloat(x.JiFen).toFixed(2));
						jQuery('#consum').replaceWith(x.Consumption);
						jQuery('#grad').replaceWith(x.Grade);
						jQuery('#login_false').slideUp("fast",function(){jQuery('#login_true').slideDown("fast");});						
						if(typeof x.FinalUnique != 'undefined'){							
							var auctionUrl ='<a href="http://www.igxe.com/ProductAuction/auctionCheckout.cfm?f='+x.FinalUnique+' target="_blank">My Auction Item</a>';
							jQuery('#auctionspan').html(auctionUrl).show();
					 	}
					}else
						return;
				});
			}
		}
	});	
}

A_Login();

function J_LoadShoppcart(key)
{	var a_urlstr = key; 
	jQuery.ajax({
		url:a_urlstr,		
		success:function(data){
			document.getElementById("PageLoadShoppcart").innerHTML = data;
			resetCart(data);
		}
	});	
}

function none(){}

//重设购物高度
function resetCart(data)
{
	if(data == "")
	{
		window.parent.document.getElementById("shopingCartFrame").style.height =  "0px";
		return;
	}
	var hei = 120;
	var liList = document.getElementById("PageLoadShoppcart").getElementsByTagName("li");
	for(var i = 0 ; i < liList.length;i+=4)
	{
	//	alert(liList[i].offsetHeight+"_"+liList[i+1].offsetHeight+"_"+liList[i+2].offsetHeight+"_"+liList[i+3].offsetHeight)
		hei = hei + liList[i].offsetHeight + 2;
		if(!-[1,]){ hei+=15;}
	}
	window.parent.document.getElementById("shopingCartFrame").style.height = hei  + "px";

////	window.parent.document.getElementById("shopingCartFrame").style.height =  dataList.length * vv + 125 + "px";	
}

