var err=1;
var tf=top;
if(typeof(tf.err)!='undefined')
{
err=tf.err
}
if(err!=0)
{
window.onerror = function(){return true};
document.oncontextmenu=function(){if(window.event.srcElement.tagName!='INPUT'&&window.event.srcElement.tagName!='TEXTAREA'){return false}};
document.onselectstart=function(){
if(window.event.srcElement.tagName!='INPUT'&&window.event.srcElement.tagName!='TEXTAREA')
{return false;}
};
}
function add(f)
{
document.location.href="pt_tr.asp?fileName="+f+"&exe=add";	
}
function set_print_col(f,typ)
{
var s='resizable:yes;status:no;help:no;dialogHeight:600px;dialogWidth:300px';
window.showModalDialog("../main/show_more_list_col.htm?list_or_win="+typ+"&fileName="+f,window,s)
}
function del(f)
{
var ed=0;
var cs=document.getElementsByName("id");
for(var i=0;i<cs.length;i++)
{
if(cs[i].checked==true)ed=1;
}
if(ed==0)
{
alert('你没有选中任何记录')
return;	
}
form1.action="execute.asp?exe=del&from_page=pt&fileName="+f;
form1.submit()
}
function undel(f)
{
var ed=0;
var cs=document.getElementsByName("id");
for(var i=0;i<cs.length;i++)
{
if(cs[i].checked==true)ed=1;
}
if(ed==0)
{
alert('你没有选中任何记录')
return;	
}
form1.action="execute.asp?exe=undel&from_page=pt&fileName="+f;
form1.submit()
}
function del_del(f)
{
var ed=0;
var cs=document.getElementsByName("id");
for(var i=0;i<cs.length;i++)
{
if(cs[i].checked==true)ed=1;
}
if(ed==0)
{
alert('你没有选中任何记录')
return;	
}
if(confirm('删除后，无法找回记录。\n\n你真的要"彻底删除"所选记录吗?'))
{
form1.action="execute.asp?exe=del_del&from_page=pt&fileName="+f;
form1.submit()
}
}
function del_all(f)
{
if(confirm('清空后，无法找回记录。\n\n你真的要"清空"回收站的所有记录?'))
{
document.location.href="execute.asp?exe=del_all&from_page=pt&fileName="+f;
}
}
function exit_del(f)
{
document.location.href="pt_main.asp?fileName="+f;
}
function gid(id,win)
{
try
{
if(!win){win=window;}
var obj=win.document.getElementById(id);
if(obj)
{
if(obj.id!=id)
{
var objs=win.document.all(id)
for(var i=0;i<objs.length;i++)
{
if(objs[i].id==id)
{	
obj=objs[i]
break;
}
}
}
}
return obj;
}catch(err){}
}
function giv(id,win)
{
var o=gid(id,win);
return (o)?(o.value):("");
}
function get_ran(n)
{
return parseInt(n*Math.random()); 　
}
function s_h_obj(obj,t)
{
if (!obj)return;
if(!t)var t="block";
obj.style.display=(obj.style.display=='none')?t:'none';
}
function show_del(f)
{
document.location="pt_main.asp?del=1&fileName="+f;
}
function sel_all(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
function sh_top(obj)
{
var f1=parent.document.getElementById('f1');
if(!f1)return;
if(!obj.id)
{
var obj=document.getElementById("but_sh_top");
if(!obj)return;
obj.src=(f1.rows=="0,*")?'../img/top_to_bottom.gif':'../img/bottom_to_top.gif';
}
else
{
if(f1.rows=="0,*")
{
f1.rows="90,*";
obj.src='../img/bottom_to_top.gif';
}
else{
f1.rows="0,*";
obj.src='../img/top_to_bottom.gif';
}
}
}
function sh_left(obj)
{
var f3=parent.document.getElementById('f3');
if(!f3)return;
if(!obj.id)
{
var obj=document.getElementById("but_sh_left");
if(!obj)return;
obj.src=(f3.cols=="0,*")?'../img/left_to_right.gif':'../img/right_to_left.gif';
}
else
{
if(f3.cols=="0,*")
{
f3.cols="200,*";
obj.src='../img/right_to_left.gif';
}
else{
f3.cols="0,*";
obj.src='../img/left_to_right.gif';
}
}
}
function sou(f)
{
var key=document.getElementById("keyword").value;
var url="?sou_shai_type=sou&col_name=_notMemo_&fuhao=like&KeyWord="+encodeURIComponent(key)+"&fileName="+f;
document.location.href=url;
}
function pt_save()
{
form1.submit();	
}
function set_title()
{  
var obj=window.event.srcElement;
if(obj.tagName=='DIV')
{
if(obj.parentElement.tagName=='TD')
{
var v=getInnerText(obj);
if (obj.title!=v)obj.title=v;
}
}
}
function getInnerText(element)
{
return (typeof element.textContent == "string") ? element.textContent : element.innerText;
}
function hslToRgb(h, s, l){
var r, g, b;
if(s == 0){
r = g = b = l; 
}else{
var hue2rgb = function hue2rgb(p, q, t){
if(t < 0) t += 1;
if(t > 1) t -= 1;
if(t < 1/6) return p + (q - p) * 6 * t;
if(t < 1/2) return q;
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
}
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function rgbToHsl(r, g, b)
{
r /= 255, g /= 255, b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min)
{
h = s = 0; 
}else
{
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max)
{
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, l];
}