﻿var $ = function(id){	return document.getElementById(id);};

function JSsetHomePage(obj){
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage("http://www.ls53.com/");
	return(false);
}

function JSAddFavorite(){
	if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) ){
	//  firefox
		window.sidebar.addPanel( '芦珊婚恋集团_交友_征婚_婚介_中国权威婚恋机构', 'http://www.ls53.com/', '');
	}
	else if ( document.all && "object" == typeof( window.external ) ){
	//  ie
		window.external.addFavorite( 'http://www.ls53.com/', '芦珊婚恋集团_交友_征婚_婚介_中国权威婚恋机构' );
	}
}

/*function WinOpen(e,n,w) {
	_height= window.screen.availHeight - 49;
	_width =w;
	window.open(e,n,"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width="+_width+",height="+_height+",top=0,left=0");
}*/

function WinOpen(e,n,w,h) {
	//_height= window.screen.availHeight - 49
	_height	= h	
	_width	= w;
	_top	= (window.screen.availHeight/2) - (h/2)
	_left	= (window.screen.availWidth/2) - (w/2)

	window.open(e,n,"toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width="+_width+",height="+_height+",top="+_top+",left="+_left);
}

function busgo(e){
	str = encodeURI(e);
	window.open("http://www.bjbus.com/home/map_section.php?uTab=1&uType=3&uKeyword="+str);
}

function showLadyPhoto(e){
	var p = $("LadyPhotoPage").getElementsByTagName("a");
	for (i=0;i<p.length;i++){
		if (e == p[i]){
			$("LadyPhoto").href = e.href;
			$("LadyPhoto").getElementsByTagName("img")[0].src = e.rev;
			p[i].className = "on";
		}else{
			p[i].className = "";
		}
	}
}

function ShowTip(e){
	var oleft = e.offsetLeft;
	var otop  = e.offsetTop;
	var ohtml = e.childNodes[0].outerHTML;
	//alert(oleft +" - "+ohtml);
	str = '<div style="position:absolute;left:'+ oleft +'px;top:'+ otop +'px;">'
	str = str + '<div style="width:16px;height:16px;border:1px solid #690;border-bottom:1px solid #fff;">'+ ohtml +'</div>'
	str = str + '<div style="border:1px solid #690;margin-top:-1px;background:#fff;width:100px;height:100px;">dd</div></div>'
	e.innerHTML = str;
}

function show2Box(e1,e2){
	$(e1).style.display = '';
	$(e2).style.display = 'none';
}

function sHotMem(e1,e2){
	$(e1).style.display = '';
	$(e2).style.display = 'none';
	$(e1+"T").className = 'hot';
	$(e2+"T").className = '';
}


function display(e){
	$(e).style.display = ($(e).style.display=='none')?'':'none';
}

function checkImgType(fileURL){  
	var right_type=new Array(".gif",".jpg",".jpeg",".png",".bmp")  
	var right_typeLen=right_type.length;  
	var imgUrl=fileURL.value.toLowerCase();  
	var postfixLen=imgUrl.length;  
	var len4=imgUrl.substring(postfixLen-4,postfixLen);  
	var len5=imgUrl.substring(postfixLen-5,postfixLen);  
	for (i=0;i<right_typeLen;i++){  
		if((len4==right_type[i])||(len5==right_type[i])){  
			var a = 1;
		}
	}
	if (a != 1){
		alert("We only accept image format: jpg, jpeg, gif, bmp, png.");
		fileURL.value = null;
		fileURL.outerHTML = fileURL.outerHTML;
	}
}

function copy_clip(copy){
	if (window.clipboardData){
		window.clipboardData.setData("Text", copy);}
	else if (window.netscape){
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
	if (!clip) return;
	
	var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
	if (!trans) return;
	trans.addDataFlavor('text/unicode');
	var str = new Object();
	var len = new Object();
	var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
	var copytext=copy;
	str.data=copytext;
	trans.setTransferData("text/unicode",str,copytext.length*2);
	var clipid=Components.interfaces.nsIClipboard;
	if (!clip) return false;
	clip.setData(trans,null,clipid.kGlobalClipboard);}
	//alert("已复制"+copy)
	return false;
}

