﻿function $(elementName)
{return document.getElementById(elementName);}
function changeUrl(url)
{location.href=url;}
function openUrl(url)
{window.open(url);}
function loginUrl(url)
{if(location.href.indexOf("?returnUrl=")>-1)
{location.href=url+"?returnUrl="+encodeURI(location.href.substr(0,location.href.indexOf("?returnUrl=")));}
else
location.href=url+"?returnUrl="+encodeURI(location.href);}
function LTrim(str)
{var whitespace=new String(" \t\n\r");var s=new String(str);if(whitespace.indexOf(s.charAt(0))!=-1)
{var j=0,i=s.length;while(j<i&&whitespace.indexOf(s.charAt(j))!=-1)
{j++;}
s=s.substring(j,i);}
return s;}
function RTrim(str)
{var whitespace=new String(" \t\n\r");var s=new String(str);if(whitespace.indexOf(s.charAt(s.length-1))!=-1)
{var i=s.length-1;while(i>=0&&whitespace.indexOf(s.charAt(i))!=-1)
{i--;}
s=s.substring(0,i+1);}
return s;}
function Trim(str)
{return RTrim(LTrim(str));}
function getABSLeft(obj)
{var x=obj.offsetLeft;while(obj=obj.offsetParent){x+=obj.offsetLeft;}
return x;}
function getABSTop(obj)
{var y=obj.offsetTop;while(obj=obj.offsetParent){y+=obj.offsetTop;}
return y;}
function AddFvtgc()
{var title=document.title;var url=document.location.href;if(window.sidebar)
{window.sidebar.addPanel(title,url,"");}
else if(document.all)
{window.external.AddFavorite(url,title);}}
function AddHomegc()
{var url=document.location.href;if(document.all)
{document.body.style.behavior='url(#default#homepage)';document.body.setHomePage(url);}
else if(window.sidebar)
{if(window.netscape)
{try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
catch(e)
{alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");}}
var prefs=Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);prefs.setCharPref('browser.startup.homepage',url);}}
function ResizeImage_Special(img,w,h)
{var image=new Image();image.src=img.src;var iw=image.width;var ih=image.height;var iratio=iw/ih;if(iw>w)
{iw=w;ih=w/iratio;}if(ih>h)
{ih=h;iw=h*iratio;}if(iw<w&&ih<h)
{iw=w;ih=w/iratio;if(ih>h)
{ih=h;iw=h*iratio;}}img.width=iw;img.height=ih;img.style.marginTop=(h-ih)/2+"px";}
var ComAdminUrl={hostUrl:"http://admin.18show.cn",homepage:"/DefaultAdmin.aspx",editproduct:"/Show/Product_Edit.aspx",sharenews:"/Person/News_List.aspx",ordernews:"/Person/News_List.aspx",pointchange:"/Show/Point_Change.aspx"};function GoToComAdmin(url){window.open(ComAdminUrl.hostUrl+url);}
function ApplyADPlace(){window.open("http://admin.yi-z.cn/Cooperation/ADP.aspx");}
function GetComAdminUrl(url){return ComAdminUrl.hostUrl+url;}
function RedirectCoadminUrl(url){if(isLogin==1){window.open(GetComAdminUrl(url));}else{window.location='/main/login.aspx?returnUrl='+GetComAdminUrl(url);}}
function GetHostUrl(){return window.location.host;}
﻿
var ShowAboutUsUrl={aboutus:"/aboutus.html",companyculture:"/companyculture.html",serviceitem:"/serviceitem.html",webservice:"/webservice.html",siteintro:"/siteintro.html",copyright:"/copyright.html",sitemap:"/sitemap.html",contactus:"/contactus.html",service:"/service.html",suggest:"http://www.18show.cn/bbs/showforum-8.aspx"};var ShowTopUrl={comadmin:"http://admin.yi-z.cn",register:"/register.html",login:"/main/login.aspx",service:"/service.html",adservice:"/adservice.html",gold:"/Adplace/default.html",sitemap:"/sitemap.html",help:"http://help.18show.cn",saleProduct:"http://admin.yi-z.cn/Show/Product_Edit.aspx",buyProduct:"/product/",shareNews:"http://admin.yi-z.cn/Person/ShareNews.aspx",publishEx:"/exporegister.html"};
function filterStrForSearch(str)
{if(str.length==0)
return"";str=str.replace(/\#|\&|\*|\_|\[|\]|\||\/|\<|\>|\?|\:|\"|\'|\%|\./g,"");return str;}
function GetRandomNum(Min,Max){var Range = Max - Min;var Rand = Math.random();return(Min + Math.round(Rand * Range));}

function $Show(elementName){return document.getElementById(elementName).style.display="block";}
function $Hide(elementName){return document.getElementById(elementName).style.display="none";}
function GetHostUrl(){return window.location.host;}

function GetTradeShowUrl(showID){
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeShowUrl', 'showID': showID, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function GetTradeShowContactUrl(tradeShowType,tradeshowurl,showID,urlGroups)
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeShowContactUrl', 'tradeShowType': tradeShowType,'tradeshowurl': tradeshowurl, 'showID': showID, 'urlGroups': urlGroups, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function GetTradeProductSearchUrl(urlencode,requestStr,tradeShowType,tradeshowurl,showID,catalogID,urlGroups)
{
if(urlencode=="")
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeProductCatalogUrl', 'tradeShowType': tradeShowType,'tradeshowurl': tradeshowurl, 'showID': showID, 'catalogID': catalogID, 'urlGroups': urlGroups, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}
else
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeProductSearchUrl', 'tradeShowType': tradeShowType,'tradeshowurl': tradeshowurl, 'showID': showID, 'keyword': requestStr, 'urlGroups': urlGroups, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}
}

function GetTradeShowContactUrl2(showID)
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeShowContactUrl2', 'showID': showID, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function GetTradeShowIntroUrl(showID)
{    
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeShowIntroUrl', 'showID': showID, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function GetTradeProductCatalogListUrl(showID)
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeProductCatalogListUrl', 'showID': showID, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function GetTradeProductViewImage(showID,productID)
{
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': 'GetTradeProductViewImage', 'showID': showID, 'productID': productID, 'hostUrl': GetHostUrl() },
        success: function(data) {
            callbackOpenUrl(data);
        }
    });
}

function callbackOpenUrl(res){window.open(res);}
function GetRandomNum(Min,Max){var Range=Max-Min;var Rand=Math.random();return(Min+Math.round(Rand*Range));}


function pwdtipcolse(obj,type)
{   jQuery(obj).parent().hide();
    jQuery.ajax({
        type: "POST",
        url: "/Main/AjaxDataPage.aspx",
        data: { 'DataType': "ReadMsg","MsgType":type },
        success: function(data) {
        }
    });
}
