﻿function GE(a){return document.getElementById(a);}
function createXMLHttps()
{
var ret=null;
try{
ret=new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e){
try{
ret=new ActiveXObject('Microsoft.XMLHTTP');
}
catch(ee){
ret=null;
}
}
if(!ret&&typeof XMLHttpRequest!='undefined')
ret=new XMLHttpRequest();
return ret;
}
function onSec(obj){
if(obj.value.toLowerCase()=="use keyword or id"){
obj.value="";
}
}
function blurSec(obj){
if(trim(obj.value)==""){
obj.value="Use Keyword or ID";
}
}
function checkSearch(obj){
if(trim(obj.keyword.value)==""||obj.keyword.value.toLowerCase()=="use keyword or id"){
alert("Please input the keyword or ID to search!");
obj.keyword.focus();
return false;
}
}
function tofavorite(){
if(window.sidebar){
window.sidebar.addPanel("AYPearl.com-Wholesale jewelry center in China","http://www.aypearl.com/","");
}else if(document.all){
window.external.addFavorite("http://www.aypearl.com/","AYPearl.com-Wholesale jewelry center in China");
}else if(window.opera&&window.print){
return true;
}
}
function setHomepage()
{
if(document.all)
{
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.aypearl.com');
}
else if(window.sidebar)
{
if(window.netscape)
{
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
}
catch(e)
{
alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
}
}
var prefs=Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage','http://www.aypearl.com');
}
}
function picClick(pid){
GE("smallpic").src=GE(pid).src;
try{
GE("bigpic").src=GE(pid).src;
}catch(e){}
GE(pid).className="now";
for(i=1;i<5;i++){
if(pid!="bspic"+i){
try{
GE("bspic"+i).className="";
}catch(e){}
}
}
}
function picClick2(pid){
GE("smallpic").src=GE(pid).src;
try{
GE("bspic").src=GE(pid).src;
}catch(e){}
GE(pid).className="current";
for(i=1;i<5;i++){
if(pid!="bspic"+i){
GE("bspic"+i).className="";
}
}
}
function onsearch(obj){
if(obj.value=="keywords or ID"){
obj.value="";
obj.className="search-col";
}
}
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}
function trim(str){
return str.replace(/(^\s*)|(\s*$)/g,"");
}
function ltrim(str){
return str.replace(/(^\s*)/g,"");
}
function rtrim(str){
return str.replace(/(\s*$)/g,"");
}
function checkmail(obj){
if(trim(obj.email.value)==""||trim(obj.email.value)=="Your Email Address")
{
alert("Please input your email!");
obj.email.focus();
return false;
}else{
if(obj.email.value.charAt(0)=="."||
obj.email.value.charAt(0)=="@"||
obj.email.value.indexOf('@',0)==-1||
obj.email.value.indexOf('.',0)==-1||
obj.email.value.lastIndexOf("@")==obj.email.value.length-1||
obj.email.value.lastIndexOf(".")==obj.email.value.length-1)
{
alert("Please enter a valid e-mail address.");
obj.email.focus();
return false;
}
}
}
var navigatorName="Microsoft Internet Explorer";
var isIE=false;
if(navigator.appName==navigatorName)isIE=true;
function OpenMWin(url,w,h)
{
var theDes="status:no;center:yes;help:no;minimize:no;maximize:no;dialogWidth:"+w+"px;scroll:no;dialogHeight:"+h+"px;border:think";
return self.showModalDialog(url,null,theDes);
}
function openwin(str,id){
if(str=="productQuestion"){
window.open('/help/Question.asp?id='+id,'newwindow','status=no,scrollbars=auto,top=100,left=270,width=640,height=850')
}
if(str=="larger"){
window.open('/larger.asp?id='+id,'newwindow','status=no,scrollbars=auto,top=100,left=270,width=680,height=650')
}
}
function openKFWin(){
var url="http://www.aypearl.com/dialog_1.htm?arg=ayjewelry&style=6&kflist=off&kf=008,004&zdkf_type=1&language=en&charset=utf-8&lytype=0&referer=http%3A%2F%2Fwww.aypearl.com%2F&keyword=&tpl=crystal_blue";
window.open(url,'LiveCheat','status=no,scrollbars=auto,top=200,left=310,width=700,height=472');
}
function closeWindow(){
window.opener=null;
window.open('','_self');
window.close();
}
function toWish(bijouID){
if(bijouID!=""){
window.location.href="/order/wishAdd.asp?id="+bijouID;
}
}

function flashChecker()
{
var hasFlash=0;         //是否安装了flash
var flashVersion=0; //flash版本
var isIE=/*@cc_on!@*/0;      //是否IE浏览器

if(isIE)
{
var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(swf) {
hasFlash=1;
VSwf=swf.GetVariable("$version");
flashVersion=parseInt(VSwf.split(" ")[1].split(",")[0]);
}
}else{
if (navigator.plugins && navigator.plugins.length > 0)
{
var swf=navigator.plugins["Shockwave Flash"];
    if (swf)
     {
hasFlash=1;
        var words = swf.description.split(" ");
        for (var i = 0; i < words.length; ++i)
{
            if (isNaN(parseInt(words[i]))) continue;
            flashVersion = parseInt(words[i]);
}
    }
}
}
return {f:hasFlash,v:flashVersion};
}


