// JavaScript Document
$(document).ready(function() {
	$("#tabs").css("display","");
	$("#tabs").tabs({
		//cache: true,
	    select:function(event, ui) {
//			if(ui.index==0)
//				changeColor("#spnDJXX");
//			if(ui.index==1 )
//				changeColor("#spnTDXX");
//			if(ui.index==2)
//				changeColor("#spnFCXX");
			if(ui.index==1 && !$("#IDCXX").attr("src"))
			{
				$("#IDCXX").attr("src","../sjcj/ADDT12002.action?ACT=C");
			}
			
			if(ui.index==2 && !$("#IFCXX").attr("src"))
			{
				$("#IFCXX").attr("src","../sjcj/ADDT12003.action?ACT=C");
			}
			
			if(ui.index==3 && !$("#IMXXX").attr("src"))
			{
				$("#IMXXX").attr("src","../sjcj/VIEWT12004.action?ACT=G");
			}
    	}	
	});
	$("#IDJXX").attr("src","../sjcj/ADDT12001.action?ACT=C");
	
	window.setInterval("reinitIframe()", 500);
});

function reinitIframe(){
	iframe = document.getElementById("IFCXX");
	try{
	iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
	}
	catch (ex){}
	
	iframe = document.getElementById("IDCXX");
	try{
	iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
	}
	catch (ex){}
	
	iframe = document.getElementById("IDJXX");
	try{
	iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
	}
	catch (ex){}
	
	iframe = document.getElementById("IMXXX");
	try{
	iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
	}
	catch (ex){}
	
}

function addDJXX(act){
	$("#tabs").tabs('select', 0);
	$("#IDJXX").attr("src","../sjcj/VIEWT12001.action?ACT=" + act);
}

function addDCXX(swid){
	$("#tabs").tabs('select', 1);
	$("#IDCXX").attr("src","../sjcj/ADDT12002.action?ACT=C&txtSWID=" + encodeURI(swid));
}

function addFCXX(dcid){
	$("#tabs").tabs('select', 2);
	$("#IFCXX").attr("src","../sjcj/ADDT12003.action?ACT=C&txtDCID=" + encodeURI(dcid));
}
//返回房产信息
function backFCXX(act){
	$("#tabs").tabs('select', 2);
	$("#IFCXX").attr("src","../sjcj/VIEWT120034.action?ACT="+act);
}

function addMXXX(fcid){
	$("#tabs").tabs('select', 3);
	$("#IMXXX").attr("src","../sjcj/ADDT12004.action?txtFCID=" + encodeURI(fcid));
}

/**
 * 更改导航条顺序
 * @param obj
 * @return
 */
function changeColor(obj){
	var spnDJXX = "#spnDJXX";
	var spnTDXX = "#spnTDXX";
	var spnFCXX = "#spnFCXX";
	var spnMXXX = "#spnMXXX";
	if(obj == spnDJXX){
		$(spnDJXX).css({ color: "green", background: "yellow" });
		$(spnTDXX).css({ color: "green", background: "white" });
		$(spnFCXX).css({ color: "green", background: "white" });
		$(spnMXXX).css({ color: "green", background: "white" });
	}else if (obj == spnTDXX) {
		$(spnDJXX).css({ color: "green", background: "white" });
		$(spnTDXX).css({ color: "green", background: "yellow" });
		$(spnFCXX).css({ color: "green", background: "white" });
		$(spnMXXX).css({ color: "green", background: "white" });
	}else if(obj == spnFCXX){
		$(spnDJXX).css({ color: "green", background: "white" });
		$(spnTDXX).css({ color: "green", background: "white" });
		$(spnFCXX).css({ color: "green", background: "yellow" });
		$(spnMXXX).css({ color: "green", background: "white" });
	}
	else if(obj == spnMXXX){
		$(spnDJXX).css({ color: "green", background: "white" });
		$(spnTDXX).css({ color: "green", background: "white" });
		$(spnFCXX).css({ color: "green", background: "white" });
		$(spnMXXX).css({ color: "green", background: "yellow" });
	}
	else{
		//alert();
	}
}