/****************arg for high light*******************/

var highlyDay = 7;                         //control the day of high light
var DataCountTypeOne = 20;                 //Type one:20 data  a page
var DataCountTypeTwo = 40;				   //Type one:40 data  a page
var classNameForDate = "date_black"         //all classNameForDate
var classNameForDateInModel = "date_black1"
var timeURL = "/663.htm";
var newsAndNoticeClassNameForNew = "new";
var newsAndNoticeClassNameForNewList = "new_blue";

var homePageClassNameForNew = "new";
var homePageClassNameForDate = "date_blue";



var VAIOClassNameForNew = "new_blue";
var VAIOClassNameForNewInModel = "new_blue1";          
var VAIOArrow = "arrow_blue";
var VAIOColor = "#0099FF";
var URL = "testTime.html";

var DIClassNameForNew = "new_blue";
var DIArrow = "arrow_blue";
var DIColor = "#87C0EE";

var EDMCClassNameForNew = "new_deepblue";
var EDMCArrow = "arrow_deepblue";
var EDMCColor = "#0086CD";

var AUDIOClassNameForNew = "new_purple";
var AUDIOArrow = "arrow_purple"
var AUDIOColor = "#ADA9CE";

var OTHERClassNameForNew = "new_yellow"
var OTHERArrow = "arrow_yellow";
var OTHERColor = "#FE9900";

var TVClassNameForNew = "new_red";
var TVArrow = "arrow_red";
var TVColor = "#C51230";





/*****************************************/

function iid(id){
return document.getElementById(id);
}
function chg_bg(top_no)
{
	iid(top_no).className="gray_bg";
}
function chg_bg_none(top_no)
{
	iid(top_no).className="width120";

}
function show_son(top_no)
{
	iid(top_no).className="gray_bg";
	iid("menu2").className="menu2";
	
}
function hid_son(top_no)
{
	iid(top_no).className="width120";
	iid("menu2").className="hid";
	
}

function show_son2(menu_no)
{
	iid(menu_no).className="blue_bg2";
	iid("menu3").className="menu3";
	
}

function chg_bg2(son_no)
{
	iid(son_no).className="bg_blue";
	iid("menu3").className="hid";
	iid("menu2_1").className="noclass";
}
function chg_bg3(son_no)
{
	iid(son_no).className="bg_blue";
}
function chg_bg2_none(top_no)
{
	iid(top_no).className="noclass";

}

function chg_bg2_none1(top_no)
{
	iid(top_no).className="noclass";
}


var _MODEL=""

var _PATH_PREFIX="http://service.sony.com.cn/vaio/"

var _ERRORS={};
_ERRORS.GENERAL="该功能只适用于2005年秋季（包含2005年秋季）以后销售的VAIO机型，对于2005\n秋季以前销售的机型，请使用“快速导航”功能来进入机型支持页面。";
_ERRORS.BROWSER="如需该功能，请使用微软IE浏览器访问。谢谢！";

function searchGoToModelTag(){
	var s=$j("#goToMyModel");
	return s;
}


function doInitGoToModeTag(){
	
	var theTag=searchGoToModelTag();
	
	
	if(theTag){
		$j(theTag).bind('click',checkUVAX);
		$j(theTag).attr('style','cursor:pointer');
	}
}

function checkUVAX(){
	//check IE browser
	if(!$j.browser.msie){
		alert(_ERRORS.BROWSER);
		return;
	}else{
		goToPage();
	}
}

function goToPage(){
	
	if(_MODEL==""){
		//alert('ss');
		alert(_ERRORS.GENERAL);
			
	}else{
		var s=_processUrl(_MODEL);
		//window.location.href=s;
		//alert(s);
		checkPage(s);
	}

}

function _processUrl(model){
	var mdl=model.replace(/\//g,"_");
	//alert(_PATH_PREFIX+mdl+".htm");
	
	return _PATH_PREFIX+mdl+".htm";
}


function addAtvXDrvr(){


 var bVU4_32installed=false;
 var bVU4_64installed=false;

 // VU4 == 18Aug2008 Update
 var strCodeBaseVU4_32 = '<OBJECT CLASSID="clsid:DEEF7337-3D42-489F-986E-6AC70D1A807C" NAME="VUAX" WIDTH=0 HEIGHT=0></OBJECT>';
 // VU4 64 == 18Aug2008 Update
 var strCodeBaseVU4_64 = '<OBJECT CLASSID="clsid:644157DD-B6DF-4B55-8537-778E38D79935" NAME="VUAX" WIDTH=0 HEIGHT=0></OBJECT>';
 
 var strCodeBaseVU5='<OBJECT CLASSID="clsid:BB10673B-4628-44A9-BFE6-56416E5A54F6" NAME="VUAX" WIDTH=0 HEIGHT=0></OBJECT>'
 
 
	

   bVU4_32installed=_checkVU432();
   bVU4_64installed=_checkVU464();
   bVU5_installed=_checkVU5();
   
   if (bVU4_32installed) {
		//alert("32: " &  VUAC.GetModelName());
		$j('head').prepend(strCodeBaseVU4_32);
		
	}else if(bVU4_64installed){
	
		$j('head').prepend(strCodeBaseVU4_64);
	}else if(bVU5_installed){
	
		$j('head').prepend(strCodeBaseVU5);
	}
	
	if(bVU4_32installed||bVU4_64installed||bVU5_installed){
		
		//alert("The mode Name is "+VUAX.GetModelName());
		
	
		_MODEL=VUAX.GetModelName();
	}
	

	
}

//check 32 bit driver
function _checkVU432(){
	
	var bVU4_32installed=false;
	
	try {
		var xObjVU4_32 = new ActiveXObject("VUAX.VUAXCtrl.4");
		if (xObjVU4_32 == null) {
				bVU4_32installed = false;
				
		} else {
				bVU4_32installed = true;
				//alert(" VU4(32) Installed " + xObjVU4_32 + "__");
				}
		}
		catch (e) {
				bVU4_32installed = false;
				//alert(" VU4(32) ûаװ:ERROR");
		}
	 
	 return bVU4_32installed;

}

//check 64 bit driver
function _checkVU464(){

	var bVU4_64installed=false;
	
	try {
		var xObjVU4_64 = new ActiveXObject("VUAX.VUAXCtrl.4.64");
		if (xObjVU4_64 == null) {
			bVU4_64installed = false;
			//alert(" VU4(64) Not Installed");
		} else {
			bVU4_64installed = true;
			//alert(" VU4(64) Installed " + xObjVU4_64);
				}
		}catch (e) {
			bVU4_64installed = false;
			//alert(" VU4(64) Not Installed");
	}
	
	return bVU4_64installed;

}

function _checkVU5(){
	
	var bVU5_installed=false;
	
	try {
		var xObjVU4_64 = new ActiveXObject("VUAX.VUAXCtrl.5");
		if (xObjVU4_64 == null) {
			bVU5_installed = false;
			//alert('VUAX1.5 not installed')
		} else {
			bVU5_installed = true;
			//alert('VUAX1.5 not installed')
				}
		}catch (e) {
			bVU5_installed = false;
			//alert('VUAX1.5 installed')
	}
	
	return bVU5_installed;
}

/**
 * advanced ajax
 * @param url
 * @param params
 * @param success
 * @param error
 * @return
 */
function reqPage(url, params, success, error) {
    var CallParams = {};
    CallParams.type = "POST";
    CallParams.url = url;
    CallParams.processData = true;
    CallParams.data = params;
    //CallParams.dataType = "json";
    CallParams.success = success;
    if (error) {
        CallParams.error = error;
    }
    $j.ajax(CallParams);
}

/**
 * 
 * @return
 */
function checkPage(theUrl){
		//alert('The URL '+theUrl);
		
		$j.ajaxSetup({async: false});
		
		reqPage(theUrl,{},
		function(data){
			window.location.href=theUrl;
		},
		function(request,settings,thrownError){
			
			if(request.status!=404){
				window.location.href=theUrl;
			}else{
				alert(_ERRORS.GENERAL);
			}
			
		});
		
		$j.ajaxSetup({async: true});
		

}
function ReplaceSpecialStrforFlash(str1){
                    newstr1 = str1.replace(/\&/g, "%26");    // 用 "&" 替换 "_a_"
                    mystr1=newstr1.replace(/\=/g,"%3D");     // 用 "=" 替换 "_d_"
					mystr1=mystr1.replace(/\;/g,"%3B");
                    return(mystr1);                       // 返回替换后的字符串
                }

$j(document).ready(function(){
					addAtvXDrvr();
					doInitGoToModeTag();
				   });
