String.prototype.isArgument=function()
{
	return /^([a-zA-Z]){1,}=([0-9]){1,}$/.test(this);
}

/*
call this function just work like window.open(url,name,feature);
however, for IE5.0+, it will open a showModelessDialog window;
and For Gecko(Mozilla or Netscape), the child window will stay on top focus untill user close it.
programmed by hedger
hedger@yahoo-inc.com
*/


function dialog(url,name,feature,isModal)
{
 if(url==null){return false;}
 url = url
 if(name==null){name=""}
 if(feature==null){feature=""};
 
 if(window.showModelessDialog)
 {
  	var WindowFeature = new Object();
	WindowFeature["width"] = 400;
	WindowFeature["height"]  =400;
	WindowFeature["left"]  = "";
	WindowFeature["top"]  =  "";
	WindowFeature["resizable"]  = "";

	if(feature !=null && feature!="")
	{
      feature = ( feature.toLowerCase()).split(",");
	
      for(var i=0;i< feature.length;i++)
		{
          if( feature[i].isArgument())
			{
               var featureName = feature[i].split("=")[0];
			   var featureValue = feature[i].split("=")[1];
			  
			   if(WindowFeature[featureName]!=null){WindowFeature[featureName] = featureValue; }
			}
		}
	}
 
  if(WindowFeature["resizable"]==1 || WindowFeature["resizable"]=="1" || WindowFeature["resizable"].toString().toLowerCase()=="yes"){WindowFeature["resizable"] = "resizable:1;minimize:1;maximize:1;"}
  if(WindowFeature["left"]!=""){WindowFeature["left"] ="dialogLeft:" +  WindowFeature["left"] +"px;";}
  if(WindowFeature["top"]!=""){WindowFeature["top"] ="dialogTop:" +  WindowFeature["Top"] +"px;"; }
  if(window.ModelessDialog ==null){window.ModelessDialog = new Object() ; };
  if(name!="")
  {
   if(window.ModelessDialog[name]!=null && !window.ModelessDialog[name].closed )
   {
     window.ModelessDialog[name].focus();
	 return window.ModelessDialog[name];
   }
  }
	var F = WindowFeature["left"] +WindowFeature["top"] +  "dialogWidth:"+WindowFeature["width"] +" px;dialogHeight:"+WindowFeature["height"]+"px;center:1;help:0;" + WindowFeature["resizable"] +"status:0;unadorned:0;edge: raised; ;border:thick;"
	if(isModal)
	{
		window.showModalDialog(url,self,F);
		return false;
	}
	else
	{
		window.ModelessDialog[name] = window.showModelessDialog(url,self,F);
		return window.ModelessDialog[name];
	}	
 }
 else
 {
   if(document.getBoxObjectFor)
   {
	

	 if(isModal)
	 {		 
		 var Modal = window.open(url,name,"modal=1," + feature);
		 var ModalFocus = function()
		 {
			if(!Modal.closed){Modal.focus();}
			else{Modal =null;window.removeEventListener(ModalFocus,"focus");ModalFocus = null; };					
		 }
		 window.addEventListener( "focus",ModalFocus, false ); 
		 return false;
	 }
	 else
	 {
		return window.open(url,name,"modal=1," + feature);
	 }	 
   }
   else
   { 
     return window.open(url,name,feature);
   }
   //
 }
 return null;
}

function modal(url,feature)
{
	dialog(url,"",feature,true);
	return false;
}

// Used for client side redirect
function Redirect(dest_url)
{
    try
    {
        location = dest_url;
    }
    catch(err){}
    return false;
}

function CreateBookmarkLink(url,title) 
{

     //title = "Phone Cards and Calling Cards | IDT Calls"; 
      // Blogger - Replace with <$BlogItemTitle$> 
      // MovableType - Replace with <$MTEntryTitle$>

     //url = "http://www.IDTCalls.com";
      // Blogger - Replace with <$BlogItemPermalinkURL$> 
      // MovableType - Replace with <$MTEntryPermalink$>
      // WordPress - <?php bloginfo('url'); ?>

	 if (window.sidebar) 
	 { // Mozilla Firefox Bookmark
		    window.sidebar.addPanel(title, url,"");
	 } 
	 else 
	 {
	    if( window.external ) 
	    { // IE Favorite
		    window.external.AddFavorite( url, title); 
		}
	    else
	    { 
	        if(window.opera && window.print) 
	        { // Opera Hotlist
		        return true; 
		    }
	    }
	 }
}

function removeHTMLTags(strInput)
{
	return strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
}
// get select element and navigate to url found in the selected item value
function navigateUrl(ddl)
{
    if (ddl.selectedIndex>0)
        return Redirect(ddl.options[ddl.selectedIndex].value);
}

function ShowErrorDiv(message,type)
{
    document.getElementById("ErrorMessageDiv").style.display="block";
    document.getElementById("LabelErrorMessage").innerHTML=message;
    switch(type)
    {
        case 2:
        {
            document.getElementById("imageErrorType").src="/images/ico-info.gif";
        }break;
        case 3:
        {
            document.getElementById("imageErrorType").src="/images/ico-question.gif";
        }break;
        case 4:
        {
            document.getElementById("imageErrorType").src="/images/ico-warning.gif";
        }break;
        default:
        {
            document.getElementById("imageErrorType").src="/images/ico-error.gif";
        }break;
    }
    scroll(0,0);
    InAnimation('ErrorMessageDiv',100,'px');
}

function HideErrorDiv()
{
    if(document.getElementById("ErrorMessageDiv") != null)
        document.getElementById("ErrorMessageDiv").style.display="none";
}

function HideValidationSummary(VSID)
{
    try
    {
        document.getElementById(VSID).style.display="none";
    }
    catch(err){}
}

function ShowValidationSummary(VSID)
{
    try
    {
        document.getElementById(VSID).style.display="block";
    }
    catch(err){}
}


function findPos(obj,offsetX,offsetY) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		lasttop = 0;
		lastleft = 0;
		while (obj = obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			if (obj.offsetLeft > 0 )
			   lastleft =  obj.offsetLeft;
			curtop += obj.offsetTop;
			if (obj.offsetTop > 0 )
			    lasttop = obj.offsetTop;
		}
		curtop -= lasttop;
		curleft -= lastleft;
	}
	
	var div=document.getElementById('WaitDiv');
    if (div!=null)
    {
        div.style.display="block";
	    if ((document.getElementById && !document.all ) || document.layers)
	    {
	        div.style.left=curleft + offsetX + "px";
            div.style.top=curtop + offsetY +"px";
	    }
	    else
	    {
            div.style.left=curleft + offsetX ;
            div.style.top=curtop + offsetY;
        }
    }
}

function InAnimation(div,height,type)
{
    //See notes on the fadeOut function.
    var obj = $get(div);
    var Numanimation = new Sys.Preview.UI.Effects.NumberAnimation();
    Numanimation.set_target(obj);
    Numanimation.set_property('style');
    Numanimation.set_propertyKey('height');
    Numanimation.set_startValue(0);
    Numanimation.set_endValue(height);
    Numanimation.setValue = function(value) { this.get_target().style.height = value + type; }
    
    var target = obj.control;
    if (target == null)
        target = new Sys.UI.Control(obj);

    Numanimation.set_duration(0.2);
    Numanimation.set_fps(40);
    Numanimation.play();
 
}

function fadeIn(div)
{
    var obj = $get(div);
    var target = obj.control;
    if (target == null)
        target = new Sys.UI.Control(obj);
    var Fadeanimation = new Sys.Preview.UI.Effects.FadeAnimation();
    Fadeanimation.set_target(target);
    Fadeanimation.set_effect(Sys.Preview.UI.Effects.FadeEffect.FadeIn);
    Fadeanimation.set_duration(0.2);
    Fadeanimation.set_fps(40);
    //Fadeanimation.play();
    return Fadeanimation;
}

function fadeOut(div)
{
    var obj = $get(div);
    var target = obj.control;
    if (target == null)
        target = new Sys.UI.Control(obj);
    var Fadeanimation = new Sys.Preview.UI.Effects.FadeAnimation();
    Fadeanimation.set_target(target);
    Fadeanimation.set_effect(Sys.Preview.UI.Effects.FadeEffect.FadeOut);
    Fadeanimation.set_duration(0.2);
    Fadeanimation.set_fps(40);
    //Fadeanimation.play();
    return Fadeanimation;
}

function OutAnimation(div,height,type)
{
    //See notes on the fadeOut function.
    var obj = $get(div);
    var Numanimation = new Sys.Preview.UI.Effects.NumberAnimation();
    Numanimation.set_target(obj);
    Numanimation.set_property('style');
    Numanimation.set_propertyKey('height');
    Numanimation.set_startValue(height);
    Numanimation.set_endValue(0);
    Numanimation.setValue = function(value) { this.get_target().style.height = value + type; }
    
    
    var target = obj.control;
    if (target == null)
        target = new Sys.UI.Control(obj);
    var Fadeanimation = new Sys.Preview.UI.Effects.FadeAnimation();
    Fadeanimation.set_target(target);
    Fadeanimation.set_effect(Sys.Preview.UI.Effects.FadeEffect.FadeOut);
    
    var _animation = new Sys.Preview.UI.Effects.CompositeAnimation();
    _animation.get_animations().add(Numanimation);
    _animation.get_animations().add(Fadeanimation);
    _animation.set_duration(0.2);
    _animation.set_fps(40);
    _animation.play();
 
}

function DisplayUpdateProgress()
{
    if (!Page_IsValid)
        return;
    var div=document.getElementById('WaitDiv');
    if (div!=null)
    {
        div.style.position = "absolute";
        div.style.display="block";
    }
}

function HideUpdateProgress()
{
    var div=document.getElementById('WaitDiv');
    if (div!=null)
    {
        div.style.position = "absolute";
        div.style.display="none";
    }
}

function UrlEncode(name)
{
    return name.replace(/&/g, "and").toLowerCase().replace(/[.|(|)]/g, "").replace(/[/,| ]/g, "-").replace(/-{2,}/g, "-");
}

/* zebra.js */

var a=1;
var ab="#F4F4F4",bb="#ffffff";
