//**************************************
// new window
function popper(thisUrl,thisWindow,thisWidth,thisHeight,thisTop,thisLeft)
  {
optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',top=' + thisTop + ',left=' + thisLeft + ',buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no');
mainWin = window.open(thisUrl,thisWindow,optionString);
  }
//**************************************
// new window be scrolbaru
function pop_noscroll(thisUrl,thisWindow,thisWidth,thisHeight,thisTop,thisLeft)
{
optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',top=' + thisTop + ',left=' + thisLeft + ',status=no,menubar=no,resizable=no,scrollbars=no');
mainWin = window.open(thisUrl,thisWindow,optionString);
}

function brouser(div) {
	if (document.getElementById) 
		result=document.getElementById(div);
	else 
		result=document.all[div];
	return result;
}
//**************************************
// new window2

function open_win(ka,w,h,t,l,s)
{
options = "toolbar=0,status=0,menubar=0,scrollbars=" + s + "," + "resizable=0,top=" + t + ",left=" + l + ",width=" + w + ",height="+ h;
    pasiulymas = window.open( ka,"",options);
}
//***********************************************
// Open image in new window (resizeable)
//***********************************************
function imagePopup(url){
	if(typeof(url)!="object") {
		window._w = window.open("","","width=30,height=30,scrollbars=no,resizable=yes,top=0, left=0");
		window._w.document.open();
		window._w.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1257"><title>ZEBRA</title></head><body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0" rightmargin="0" bottommargin="0" bgcolor="#FFFFFF" text="#000000"><table border="0" cellpadding="0" cellspacing="0" background="" align="center"><tr><td><a href="#" onclick="self.close(); return false;"><img src="'+url+'" border="0" alt="Uždaryti langą?" onLoad="opener.imagePopup(this);"></a></td></tr></table></body></html>');
		window._w.document.close();
	}
	else {
		if (document.layers)
			window._w.resizeTo(url.width,url.height);		
		else
			window._w.resizeTo(url.width+10,url.height+30);
	}
}


//***********************************************
// cookie functions
//***********************************************
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expires * 3600 * 1000));
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + ExpireDate.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
function getCookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) { 
			offset += search.length
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
} 

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


/*
JIPPII logotipams ir melodijoms naudojami skriptai
2004.03.10 13:23:15
*/
orderWindowProp = "scrollbars=yes,width=470,height=350";
helpWindowProp  = "scrollbars=yes,width=470,height=350";

function orderColorGraphic(model, aindex, name) {
   return window.open("http://www.jippii.lt/takas/color/popup/color.jsp?model="+model+"&aindex="+aindex+"&name="+name, 'order', orderWindowProp);
}
function mobileorder(file,name) {
   w = window.open(file,name,'scrollbars=yes,width=470,height=350');
   w.focus();
}
function mobilemp3(file) {
   w = window.open('http://www.jippii.lt'+file,'sample','scrollbars=no,width=10,height=10');
   w.focus();
}

/* AJAX functions */
function objHttp()
{
	var C=null;
	try{C=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{C=new ActiveXObject("Microsoft.XMLHTTP")}catch(sc){C=null}}
	if(!C&&typeof XMLHttpRequest!="undefined"){C=new XMLHttpRequest()}
	return C;
}

function httpQuery(ac, type, callfunc){
	var l=null;
	if(l&&l.readyState!=0){l.abort()}
	l=objHttp();
	if(l){
		l.open("GET",ac,true);
		l.onreadystatechange=function()	{if(l.readyState==4) {eval(callfunc+"("+((type=="xml")?"l.responseXML":"l.responseText")+")");}}
		l.send(null)
	}
}



/**
 * Generates a browser-specific Flash tag. Create a new instance, set whatever
 * properties you need, then call either toString() to get the tag as a string, or
 * call write() to write the tag out.
 */

/**
 * Creates a new instance of the FlashTag.
 * src: The path to the SWF file.
 * width: The width of your Flash content.
 * height: the height of your Flash content.
 */
function FlashTag(src, width, height)
{
    this.src       = src;
    this.width     = width;
    this.height    = height;
    this.version   = '6,0,0,0';
    this.id        = null;
    this.bgcolor   = 'ffffff';
    this.flashVars = null;
    this.wmode     = null;
}

/**
 * Sets the Flash version used in the Flash tag.
 */
FlashTag.prototype.setVersion = function(v)
{
    this.version = v;
}

/**
 * Sets the ID used in the Flash tag.
 */
FlashTag.prototype.setId = function(id)
{
    this.id = id;
}

/**
 * Sets the background color used in the Flash tag.
 */
FlashTag.prototype.setBgcolor = function(bgc)
{
    this.bgcolor = bgc;
}

/**
 * Sets any variables to be passed into the Flash content. 
 */
FlashTag.prototype.setFlashvars = function(fv)
{
    this.flashVars = fv;
}

/**
 * Get the Flash tag as a string. 
 */
FlashTag.prototype.toString = function()
{
    var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var flashTag = new String();
    if (ie)
    {
        flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        if (this.id != null)
        {
            flashTag += 'id="'+this.id+'" ';
        }
        flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';
        flashTag += '<param name="quality" value="high"/>';
        flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        if (this.wmode != null)
        {
            flashTag += '<param name="wmode" value="'+this.wmode+'"/>';
        }
        if (this.flashVars != null)
        {
            flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
        }
        flashTag += '</object>';
    }
    else
    {

        flashTag += '<embed src="'+this.src+'" ';
        flashTag += 'quality="high" '; 
        flashTag += 'bgcolor="#352e1e" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'" ';
        flashTag += 'type="application/x-shockwave-flash" ';
        //flashTag += 'wmode="opaque" ';

/*
	 if (this.wmode != null)
        {
            flashTag += 'wmode="'+this.wmode+'" ';
        }
*/
        if (this.flashVars != null)
        {
            flashTag += 'flashvars="'+this.flashVars+'" ';
        }
        if (this.id != null)
        {
            flashTag += 'name="'+this.id+'" ';
        }
   
        //flashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        flashTag += '></embed>';
    }
    return flashTag;
}

/**
 * Write the Flash tag out. Pass in a reference to the document to write to. 
 */
FlashTag.prototype.write = function(doc)
{
    doc.write(this.toString());
}