﻿/*
*	用户自定义函数库
*/

function getPost(g,t){
	var url
	if(g){
		switch(g){
			case "login":
			url="../login/?url="+escape(location.href)+"&go="+t;
			break;
			
			case "register":
			url="../login/register.asp?url="+escape(location.href)+"&go="+t;
			break;
			
			case "application":
			url="../post/application_post.asp?url="+escape(location.href)+"&go="+t+"&id="+arguments[2];
			break;
		}
		location.href=url
	}	
}

function getAd(i,obj,e){
	if(typeof _Ad[i]=="object"){
		var _ext=_Ad[i][1].replace(/.*\./,"").toLowerCase();
		if(_ext=="swf"){
			var _html="<embed src='http://www.stmrmf.com/upfile/iad/"+_Ad[i][1]+"' title='"+_Ad[i][0]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>";
		}else{
			var _html="<a href='"+_Ad[i][2]+"'><img src='http://www.stmrmf.com/upfile/iad/"+_Ad[i][1]+"' alt='"+_Ad[i][0]+"' class='ad' border=0/></a>";
		}
		$(obj).innerHTML=_html;
	}else{
		if(e){$(obj).className=e;}
	}
}
function getAdList(i){
	//alert(typeof _Ad[i])
	if(typeof _Ad[i]=="object"){
		var _html="<li class='link_tag'><a href='"+_Ad[i][2]+"'>"+_Ad[i][0]+"</a></li>";
		document.write(_html);
	}
}


function AutoImage(obj,Max){
	var obj=$(obj)	
	var images=obj.getElementsByTagName("img")
	for(var i=0;i<images.length;i++){
			var width=images[i].width;
			if(width>Max){
				images[i].width=Max;
				images[i].height=parseInt(images[i].height)*(Max/width);
				images[i].className="iMax";
				images[i].onclick=function(){window.open(this.src,"","")};
			}		
	}
}

