// JavaScript Document

//页面Onload触发
window.onload = function() { externallinks(); }
document.onselectstart = function(){ return false }
document.oncontextmenu = function(){ return false }

//Rel打开新窗口
function externallinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
}

//IE6 PNG 透明 - 需要JQuery 框架支持
if ( $.browser.msie )
{
	if( $.browser.version=="6.0" )
	{
		$(document).ready(function(){
			enableAlphaImages();
		});
	}
}

function enableAlphaImages()
{
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	if (itsAllGood) 
	{
		for (var i=0; i<document.all.length; i++)
		{
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null)
			{
				var img = bg.substring(5,bg.length-2);
				var offset = obj.style["background-position"];
				obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')";
				obj.style.backgroundImage = "url('/statics/images/spacer.gif')";
				obj.style["background-position"] = offset;
			}
			else if (img && img.src.match(/\.png$/i) != null) 
			{
				var src = img.src;
				img.style.width = img.width + "px";
				img.style.height = img.height + "px";
				img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop')"
				img.src = "/statics/images/spacer.gif";
			}
		}
	}
}

// 符合标准的FLASH.OBJECT
function flash(file,width,hight) {
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+hight+'"> ');
    document.write('<param name="movie" value="' + file + '">');
    document.write('<param name="quality" value="high"> ');
    document.write('<param name="wmode" value="transparent"> ');
    document.write('<param name="menu" value="false"> '); 

    document.write('<embed wmode="transparent" src="' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+hight+'"></embed> ');
    document.write('</object> ');
}

//摄影作品信息
function ajaxReadPhotoInfo(ID)
{
    $.ajax({
	    type: "GET",
	    url: "/Ajax/ReadPhotoInfo.ashx",
	    data: "ID=" + ID,
	    cache: false,
	    success: function(data){
		    //alert(data);
			return;
	    },
	    error: function(){
		    return false;
	    }
    }); 
}