﻿function createFlashMove(obj,sName,src,width,height,wmode,fullscreen){
    var swf=document.createElement("object");
    var param=document.createElement("param");
    param.setAttribute("name","movie");
    param.setAttribute("value",src);
    param.setAttribute("allowFullScreen","true");
    swf.appendChild(param);
    if(fullscreen){
        var param=document.createElement("param");
        param.setAttribute("name","allowScriptAccess");
        param.setAttribute("value","always");
        swf.appendChild(param);
    }
    if(wmode){
        param=document.createElement("param");
        param.setAttribute("name","wmode");
        param.setAttribute("value","transparent");
        swf.appendChild(param);
    }
    var embed=document.createElement("embed");
    embed.setAttribute("type","application/x-shockwave-flash");
    embed.src=src;
    if(fullscreen) embed.setAttribute("allowScriptAccess","always");
    if(wmode) embed.setAttribute("wmode","transparent");
    embed.setAttribute("width",width);
    embed.setAttribute("height",height);
    embed.name=sName;
    obj.appendChild(swf);
    swf.setAttribute("type","application/x-shockwave-flash");
    swf.setAttribute("data",src);
    swf.setAttribute("width",width);
    swf.setAttribute("height",height);
    if(sName) swf.id=sName;
}

function Request(strName)
{
 var strHref = window.document.location.href;
 var intPos = strHref.indexOf("?");
 var strRight = strHref.substr(intPos + 1);
 var arrTmp = strRight.split("&");
 for(var i = 0; i < arrTmp.length; i++) { 
  var arrTemp = arrTmp[i].split("=");
   if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1]; }
 return "";
}
function getIPAreaSchool()
{
 $(this).html("loading...");
    var o = this;
    var xmlhttp = $.ajax({
    url:"Service/IPAreaSchool.aspx",
    dataType:"html",
    success:function(result)
   {
      $(o).html(result);
    }
  });   
}
function getLogin()
{
 $(this).html("loading...");
    var o = this;
    var xmlhttp = $.ajax({
    url:"Service/IndexLogin.aspx?time="+Math.random(),
    dataType:"html",
    success:function(result)
   {
      result=result.replace("IndexLogin.aspx","../service/IndexLogin.aspx");
        var list=result.split("$$$");
      $(o).html(list[0]); 
      
     $(".right ul").html(list[1]);
      
        var id=Request("id");
  if(id=="1")
   $("#errinfo").html("登录失败：您的帐号没有激活，请打开注册邮箱链接激活");
  else if(id=="2")
   $("#errinfo").html("登录失败：您的账号被锁定");
  else if(id=="3")
   $("#errinfo").html("登录失败：用户名或密码错误");
  }
  });   
}

$(document).ready(function(){
  getIPAreaSchool.call($("#ipschool"));
   getLogin.call($(".lngdiv"));
 createFlashMove(document.getElementById("banner"),"bannerswf","banner.swf",989,281,"1"); 
  if(location.href.toLowerCase().indexOf("www")!=-1)
    createFlashMove(document.getElementById("maplist"),"schmap","http://www.6dxy.com/schmap/6dChinaMap.swf",1000,480,"1","1"); 
  else{
    createFlashMove(document.getElementById("maplist"),"schmap","http://6dxy.com/schmap/6dChinaMap1.swf",1000,480,"1","1"); 
  }
});

function sendMessage(message) {
  document.getElementById("schmap").setProvince(message);
  //getSWF("schmap").setProvince(message);
}
	function getSWF(movieName) {
		if (navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	}