function isblank(val)
{if(val==null)
return true;
return false;
}

function setclass(objectid, classname)
{var  obj = document.getElementById( objectid );
if ( !isblank(obj) )
	obj.className=classname;
}
function setobjclass(object, classname)
{if ( !isblank(object) )
	object.className=classname;
}

function doHomePage(hp) 
{
	if (document.body.addBehavior) 
		{
		document.body.style.bahavior="url('#default#homePage')"
		document.body.addBehavior("#default#homePage");
		document.body.setHomePage("http://www."+hp+".com");	
		}
}

function doPictureSizeSet(PicCookieSize) 
{
 var expire = new Date();
 var today = new Date();
 
 expire.setTime(today.getTime() + 3600000*24*365);

 document.cookie = "picsize="+escape(PicCookieSize)+ ";expires="+expire.toGMTString();
 setTimeout('document.location=document.location',10);
 //document.location=document.location;
}

										


function AddToFavorites(siteUrl)
{

if (window.sidebar)
  {
    window.sidebar.addPanel("myVendi Home Page", siteUrl, "");
  }
  else if( document.all )
  {
	window.external.AddFavorite(siteUrl, "myVendi Home Page");
  }
  else
  {
    return true;
  }
	
	//window.external.AddFavorite("<%#Global.StaticVars['SiteUrl']%>{siteUrl}", "myVendi Home Page");
	//window.external.AddFavorite("http://myvendi.asesoft.ro", "myVendi Home Page");
}


function popupImage(imageURL,width,height){
/*    var jumpToHere;
	var winOptions;
	var popUpWindow;*/
//window.open(imageURL);
window.open(imageURL ,"Image", "width=" + width + ",height=" + height + ",toolbar=no,scrollbars=no,resizable=no,top=100,left=100, status=no,menubar=no,location=no");

//window.open("/viewpicture.aspx?upid=" + UploadID, "Upload","top="+top+",left="+left+",width="+Width+",height="+Height+", status=no,toolbar=no,menubar=no,location=no, resizeable=no, scrollbar=yes");

//    jumpToHere="popupImage.asp?img="+imageURL;
//   	winOptions = "top=0,left=0, width=100, height=100,scrollbars=yes,";
	
// 	popUpWindow = window.open(jumpToHere, "MyWindow", winOptions);
}




function popupImageByUrl(imageURL){
    var jumpToHere;
	var winOptions;
	var popUpWindow;
    
	
    //jumpToHere=imageURL;
    
    //jumpToHere="popupImage.asp?img="+imageURL;
    jumpToHere=imageURL;
    //winOptions = "top=0,left=0, width=100, height=100,scrollbars=yes,";
    winOptions = "top=0,left=0, scrollbars=yes,";
   	
 	popUpWindow = window.open(jumpToHere, "MyWindow", winOptions);
}


function trim(s)
{
	var i, j, str;
	lng = s.length;	
	i=0;
	

	if (lng==0)
		return "";
		
	while (s.substr(i, 1) == " " && i < lng)
		i++;

	if (i>0) {
		s=s.substr(i);
		lng=lng-i;
		}
		
	j=lng-1;	
	
	while (s.substr(j, 1) == " " && j > 0)
		j--;		
			
	if (j<lng-1) 	
		s=s.substr(0, j+1);
			
	return s;
}

function GetElementByName(ename)
{
	var obj;

	if (document.all)
		eval("obj = document.all.item(\"" + ename + "\")");
	else if (document.layers)
		eval("obj = document.layers.item(\"" + ename + "\")");
	else	
		obj =  undefined;

	return obj;

}

function GetInputByName(fname, ename)
{
	var form = document.forms[fname];

	for (var i = 0; i < form.elements.length; i++)
	{
		if (form.elements[i].name == ename)
			return form.elements[i];
	}
	

	return "undefined";
}






/* open win start */

function open_window(msg,title,w,h)
{
        win = window.open("", "win", "width="+w+",height="+h+",screenX=3,left=3,screenY=3,top=3");
        win.focus();
        win.document.open("text/html");
        win.document.write("<HTML><HEAD><TITLE>"+title+"</TITLE></HEAD><BODY onLoad='window.focus();' marginwidth=0 marginheight=0 topmargin=0 leftmargin=0  bgcolor=#ffffff><center>"+
        msg+"</center><p align=center><a href='javascript:' onClick='self.close()'><font face=Verdana size=1 color='#ce0000'>Close this window</font></a></p></BODY></HTML>");
        win.document.close();
}
function send_alert(msg,title)
{
        win = window.open("", "win", "width=200,height=105,screenX=350,left=350,screenY=250,top=250");
        win.focus();
        win.document.open("text/html");
        win.document.write("<HTML><HEAD><TITLE>"+title+"</TITLE></HEAD><BODY onLoad='window.focus();'  bgcolor=#d3d6ce><center>"+
        "<TABLE border=0 width=100% cellpadding=0 cellspacing=0><TR><TD align=left>"+
        "<img src=img/alert.gif width=32 height=32 hspace=20></TD><TD><font size=1 face=Verdana>"+
        msg+"&nbsp;</TD></TR></TABLE>"+
        "<FO"+"RM onSubmit='return false;' wrap=virtual name=popupForm><input type=image src='img/close.gif' onClick='self.close();'></FO"+"RM>"+
        "</center></BODY></HTML>");
        win.document.close();
}

/* open win end */

/* warning window */
function buyproduct(Prod_sellerfinanced,href)
{
var passbuy = 1
if (Prod_sellerfinanced == 1) 
{
	if ( ! window.confirm ("The purchase of this item requires an immediate Escrow Deposit, payable by credit card through the myVendi Payment Gateway.  This Escrow Deposit becomes non-refundable as soon as the Seller confirms the purchase.  The Rest-Payment including possible Shipping Charges and/or Taxes will be facilitated directly between Seller and Buyer.  By continuing this transaction you agree on the Seller's Payment Instructions.  Do you want to continue?" ) )
		passbuy = 0
}
if (passbuy == 1)

document.location = href

}
/* warning window */


function FGetElementById(ename)
{
	var obj;

	if (document.all)
		{
		eval("obj = document.all[\"" + ename + "\"]");
		}
	else if (document.layers)
	{		
		eval("obj = document.layers[\"" + ename + "\"]");
	}
	else if (document.getElementById)
	{	
		eval ("obj = document.getElementById (\"" + ename + "\")");		
	}
	else	
		obj =  undefined;

	return obj;

}
function flash1(elementId, status)
{
	var objEl = FGetElementById(elementId);
	status = 1 - status;
	if (status == 1)
		objEl.style.display = "";
	else
		objEl.style.display = "none";
	
	setTimeout('flash("' + elementId + '",' + status + ')',1000)
}
function flash(elementId, status, classcolor)
{
	var objEl = FGetElementById(elementId);
	status = 1 - status;
	if (status == 1)
		objEl.style.color = classcolor;
	else
		objEl.style.color = "white";
	
	setTimeout('flash("' + elementId + '",' + status + ',"'+classcolor+'")',300)
}

function SetCookieExpire (name, value, ExpireDays) {
SetCookieDefault(name, value, 24 * ExpireDays)
}
function SetCookie (name, value) {
SetCookieDefault(name, value, 1)
}

function SetCookieDefault (name, value, expireHours) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  var expire = new Date();
  var today = new Date();
  //expire.setTime(today.getTime() + 3600000*24*365);
  expire.setTime(today.getTime() + 3600000*expireHours);
  path = "/"
  
  document.cookie = name + "=" + escape (value) +
     ";expires="+expire.toGMTString() + 
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

