function openwinx(url,name,w,h)
{ 
    window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no")
}

function Dialog(url,name,w,h)
{
	return showModalDialog(url, name, 'dialogWidth:'+w+'px; dialogHeight:'+h+'px; help: no; scroll: yes; status: no');
}

function setidval(id,value)
{ 
    document.getElementById(id).innerHTML = value;
}

function getidval(id)
{ 
    return document.getElementById(id).innerHTML;
}

function checkall(form)
{
	for(var i = 0;i < form.elements.length; i++) 
	{
		var e = form.elements[i];
		if(e.name != 'chkall' && e.disabled != true) e.checked = form.chkall.checked;
	}
}

function redirect(url)
{
	window.location.replace(url);
}

function confirmurl(url,message)
{
	if(confirm(message)) location.href = url;
}

function confirmform(form,message)
{
	if(confirm(message)) form.submit();
}

function setcookie(name, value)
{
    name = cookiepre+name;
    var argc = setcookie.arguments.length; 
	var argv = setcookie.arguments; 
	var path = (argc > 3) ? argv[3] : null; 
	var domain = (argc > 4) ? argv[4] : null; 
	var secure = (argc > 5) ? argv[5] : false; 
	document.cookie = name + "=" + value + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); 
} 

function deletecookie(name)
{
    var exp = new Date(); 
	exp.setTime (exp.getTime() - 1); 
	var cval = getcookie(name);
    name = cookiepre+name;
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); 
}

function getcookieval(offset)
{
	var endstr = document.cookie.indexOf (";", offset); 
	if (endstr == -1) 
	endstr = document.cookie.length; 
	return unescape(document.cookie.substring(offset, endstr)); 
}

function getcookie(name)
{
        name = cookiepre+name;
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; 
	while (i < clen) { 
	var j = i + alen; 
	if (document.cookie.substring(i, j) == arg) 
	return getcookieval(j); 
	i = document.cookie.indexOf(" ", i) + 1; 
	if (i == 0) break; 
	} 
	return null; 
}

var tID=0;
function ShowTabs(ID)
{
	var tTabTitle=document.getElementById("TabTitle"+tID);
	var tTabs=document.getElementById("Tabs"+tID);
	var TabTitle=document.getElementById("TabTitle"+ID);
	var Tabs=document.getElementById("Tabs"+ID);
	if(ID!=tID)
	{
		tTabTitle.className='title1';
		TabTitle.className='title2';
		tTabs.style.display='none';
		Tabs.style.display='';
		tID=ID;
	}
}

function ChangeInput (objSelect,objInput)
{
	if (!objInput) return;
	var str = objInput.value;
	var arr = str.split(",");
	for (var i=0; i<arr.length; i++){
	  if(objSelect.value==arr[i])return;
	}
	if(objInput.value=='' || objInput.value==0 || objSelect.value==0){
	   objInput.value=objSelect.value
	}else{
	   objInput.value+=','+objSelect.value
	}
}

var flag=false; 
function setpicWH(ImgD,w,h)
{ 
	var image=new Image();
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0)
	{ 
		flag=true; 
		if(image.width/image.height>= w/h)
		{ 
			if(image.width>w)
			{  
				ImgD.width=w; 
				ImgD.height=(image.height*w)/image.width; 
				ImgD.style.display="block";
			}else{ 
				ImgD.width=image.width;  
				ImgD.height=image.height; 
				ImgD.style.display="block";
			} 
		}else{
			if(image.height>h)
			{  
				ImgD.height=h; 
				ImgD.width=(image.width*h)/image.height; 
				ImgD.style.display="block"; 
			}else{ 
				ImgD.width=image.width;  
				ImgD.height=image.height; 
				ImgD.style.display="block";
			} 
		} 
	} 
}

function checkradio(radio)
{
	var result = false;
	for(var i=0; i<radio.length; i++)
	{
		if(radio[i].checked)
		{
			result = true;
			break;
		}
	}
    return result;
}

function checkselect(select)
{
	var result = false;
	for(var i=0;i<select.length;i++)
	{
		if(select[i].selected && select[i].value!='' && select[i].value!=0)
		{
			result = true;
			break;
		}
	}
    return result;
}

var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isSafari = (navigator.userAgent.toLowerCase().indexOf("safari")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);

var Common = new Object();
Common.htmlEncode = function(str) 
{
	return str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

Common.trim = function(str)
{
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

Common.strlen = function (str)
{
   return str.replace(/[^\x00-\xff]/g, "**").length;
}

Common.isdate =function (str)
{
   var result=str.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
   if(result==null) return false;
   var d=new Date(result[1], result[3]-1, result[4]);
   return (d.getFullYear()==result[1] && d.getMonth()+1==result[3] && d.getDate()==result[4]);
}

Common.isnumber = function(val)
{
    var reg = /[\d|\.|,]+/;
    return reg.test(val);
}

Common.isalphanumber= function (str)
{
	var result=str.match(/^[a-zA-Z0-9]+$/);
	if(result==null) return false;
	return true;
}

Common.isint = function(val)
{
    var reg = /\d+/;
    return reg.test(val);
}

Common.isemail = function(email)
{
    var reg = /([\w|_|\.|\+]+)@([-|\w]+)\.([A-Za-z]{2,4})/;
    return reg.test( email );
}

Common.fixeventargs = function(e) 
{
    var evt = (typeof e == "undefined") ? window.event : e;
    return evt;
}

Common.srcelement = function(e)
{
    if (typeof e == "undefined") e = window.event;
    var src = document.all ? e.srcElement : e.target;
    return src;
}

Common.isdatetime = function(val)
{
	var result=str.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/);
	if(result==null) return false;
	var d= new Date(result[1], result[3]-1, result[4], result[5], result[6], result[7]);
	return (d.getFullYear()==result[1]&&(d.getMonth()+1)==result[3]&&d.getDate()==result[4]&&d.getHours()==result[5]&&d.getMinutes()==result[6]&&d.getSeconds()==result[7]);
}
/* UyghurWeb.com */ //================= UyghurWeb Title programming ============
var sPop = null;
var postSubmited = false;
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText {{direction:rtl;font-family:{font};text-align:right; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 13px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=90)}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>");
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";//Uyghurweb
showIt();
}
}
}

function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/<(.*)>/g,"<$1>").replace(/\n/g,"<br>");
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + 'px';
}

function signature(obj) {
if(obj.style.maxHeightIE != '') {
var height = (obj.scrollHeight > parseInt(obj.style.maxHeightIE)) ? obj.style.maxHeightIE : obj.scrollHeight;
obj.style.maxHeightIE = '';
return height;
}
}

if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}//=================

