﻿// JavaScript Document
var zhuangtai=""
	function buy(a,b){
		
	var date='<div id="wikan"><iframe src="blank" frameborder="0" scrolling="no" name="hj" id="hj"></iframe></div>'
	$.facebox(date);
	if(b){
				document.hj.location='buyselect.asp?proid='+a+'&p_num='+b
			}else{
	document.hj.location='buyselect.asp?proid='+a
	}
	
	}
	
	
	function gwcaddok(){
	var aa="提示：产品已添加到购物里，<a href='gwc.asp' target='_parent'>点击查看我的购物车</a>  <br>  若修改产品数量或颜色，<a href='gwc.asp' target='_parent'>点击我的购物车</a>。";
	$.facebox(aa);
	}
	
	function buy2(a){
nncc=$("input:checked").length
if (nncc==0){
alert("对不起，您还没有选择要订哪个规格呢")
}
var d=""
var c=""
zhuangtai=""
$("#formbuy input:checked").each(function(i){
c=$(this).val()
$.post("buy.asp",{proid:a,ngg:$("#ggt_"+c+" input[@name='ngg']").val(),spys:$("#ggt_"+c+" select[@name='spys']").val(),productnum:$("#ggt_"+c+" input[@name='productnum']").val(),addname:"gwc1"},function(date){
if(date=='nopro'){
zhuangtai='nopro'
}
nncc--
if (nncc<1 ){
//document.location='okgwc.html'
if(zhuangtai=="" || $("input:checked").length!=1){
document.location='okgwc.html'}else{
document.location='okgwccf.html'
}
}
})

})
}

 function oked(a){
$("input:checkbox[@value="+a+"]")[0].checked=true;
 }
function gwc(){
		   var now=new Date(); 

    var number = now.getSeconds();
	$.facebox("");
	var date='<div id="wikan"><iframe  width="800" frameborder="0" scrolling="no" name="hj" id="hj" height=40></iframe></div>'
	
	$.facebox(date);
	document.hj.location='gwc1.asp'

	}


	function refgwc(){
	   var now=new Date(); 

    var number = now.getSeconds();
		$.post("incfiles/gwc1.asp",{aaa:number},function(date){  eval(date);
													  $("#gwccount").text(gwccount);
													  $("#gwczonger").text(gwczonger);
													})
		}
		
		
						(function($) {
  $.facebox = function(data, klass) {
    $.facebox.init()

 $.facebox.reveal(data, klass)

  }

  $.facebox.settings = {
    loading_image : 'img/loading.gif',
    close_image   : 'img/close.gif',
    image_types   : [ 'png', 'jpg', 'jpeg', 'gif' ],
    facebox_html  : '<div id="facebox" style="display:none;"><div class="popup"><table table border="0" align="center" cellpadding="0" cellspacing="0" class="ftable"><tr><td> \
	<div class="ftitle" align="right">  <span style="cursor:pointer;" title="按Esc键也可关闭" id="face_close_img"><b onclick="$.facebox.close()">关闭窗口×</b></span></div>\
	  <div class="body">\
  <div class="content"> \
              </div></div> \
   </td></tr></table> </div> \
  </div>'
  }
  $.facebox.reveal = function(data, klass) {
	  $("#facebox").show()
    if (klass) $('#facebox .content').addClass(klass)
    $('#facebox .content').html(data)

  }

  $.facebox.close = function() {
   $("#facebox").fadeOut('fast')
	$('select').show();
    return false
  }

  $.fn.facebox = function(settings) {
	  
    $.facebox.init(settings)
  }

  $.facebox.init = function(settings) {
    if ($.facebox.settings.inited) {
      return true
    } else {
      $.facebox.settings.inited = true
    }

    if (settings) $.extend($.facebox.settings, settings)
	$('body').append($.facebox.settings.facebox_html)
  }

  $.facebox.getPageScroll = function() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
    return new Array(xScroll,yScroll) 
  }

  // adapter from getPageSize() 
  $.facebox.getPageHeight = function() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight/2
  }
})(jQuery);
						

function facejz(lh){
	//$("#facebox",parent.document.body).css({top:lh})
 if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
	lh=(windowHeight-lh)/2
	if (lh<0){lh=0}
	  if (self.pageYOffset) {
      yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
    }
	lh+=yScroll
	if($("#facebox").length>0){$("#facebox").css({top:lh})}else{
	$("#facebox",parent.document.body).css({top:lh})}
	}
