/*
(c) by insign - simply e-business
http://www.insign.ch - info(at)insign(puntk)ch

main js for all files
!!!only include in public files (no https)!!!

created 	jg	27.10.2003
last change 	jg	27.10.2003

history

*/

// 

// redirect if public site is called with https [START]
// creator 	sh	01.02.2003
// last change	sh	02.10.2003
if (window.location.href.indexOf("tps://secure.insign.ch/doncigarro")>0)
	window.location.replace(window.location.href.replace(/https:\/\/secure.insign.ch\/doncigarro.com\//,"http://www.doncigarro.ch/"));
// redirect if public site is called with https [END]



// pop-up window general [START]
// creator 	se	01.02.2003
// last change
function openPicWin(pFileName,pWinName,pWidth,pHeight)
{
	var isNS = (document.layers) ? true : false;
	
	if (isNS) pHeight = pHeight + 19;
		eval("allSettings = 'width="+pWidth+",height="+pHeight+",menubar=yes,scrollbars=yes,status=yes,resizable=yes'");
		w=window.open(pFileName,pWinName,allSettings);
		w.window.focus();
}
// pop-up window general [END]

function selectSelecter(trigger,defaultvalue)
{

	if(trigger.substr(0,1)=='%')
	{
		if(defaultvalue) trigger=defaultvalue;
		else return 0;
	}

	myselect=document.forms[document.forms.length-1].elements[document.forms[document.forms.length-1].elements.length-1];
	items = trigger.split(",");
	
	if(typeof(myselect.options) != 'undefined')
	{
		for(j=0;j<myselect.options.length;j++)
		{
			myselect.options[j].selected=false;
		}
		for(i=0;i<items.length;i++)
		{
			for(j=0;j<myselect.options.length;j++)
			{
				if(myselect.options[j].value==items[i])
				{
					myselect.options[j].selected=true;
				}
				

			}

		}
	}	
	if(myselect.selectedIndex>=0) return myselect.selectedIndex;
	else return 0;
}

function getAddress()
{
	if(document.URL.indexOf(",saveuser")==-1)
		myUrl = (document.URL.replace("storeArtToCart","storeArtToCart,saveuser"));
	else
		myUrl = document.URL;
	document.forms['adressenformular'].action= myUrl;
	document.forms['adressenformular'].submit();
}

