var ocBugFix = ""; // Workaround for bug in onchange() handler in IE
var swidth=591;
var sizeup=0;
var operbr=navigator.userAgent.toLowerCase().indexOf('opera');
var clWin = new Array();

function selectstart() {
	var o=event.srcElement;
	return ((o.tagName=="INPUT") || (o.tagName=="TEXTAREA"));
}

function hf(a, b) {
	ocBugFix = a.value;
	if (a.value == b) a.value = '';
}

function hb(a, b) {
	if (a.value == '') a.value = b;
//	if (ocBugFix != a.value) a.onchange();
}

function open_w(url, name, features) {
	var p = clWin.length;
	for (var i = 0; i < clWin.length; i++) {
		if (clWin[i] == null) {
			p = i;
		} else {
			if (clWin[i].closed) {
				clWin[i] = null;
		    } else {
				if (clWin[i].name == name) {
					clWin[i].close();
					clWin[i] = null;
				}
			}
		}
	}
	clWin[p] = window.open(url, name, features);
	clWin[p].focus();
}
function close_w() {
	for (var i = 0; i < clWin.length; i++) {
		if ((clWin[i] != null) && (!clWin[i].closed)) {
			clWin[i].close();
			clWin[i] = null;
		}
	}
}

function hi(a, b) {
	a.src = a.src.substr(0, a.src.length - 6) + "hi.gif"
	document.getElementById("highlight").innerHTML = "Click to view " + b
}

function lo(a) {
	a.src = a.src.substr(0, a.src.length - 6) + "lo.gif"
	document.getElementById("highlight").innerHTML = "Signature Bridal Jewellery"
}

function showCust(i) {
	document.getElementById("cust").src = "/images/customise/" + i + ".jpg"
}

var currentPhoto = 0;
var secondPhoto = 1;
var lastPhoto = 5;

var currentOpacity = new Array();

var FADE_STEP = 2;
var FADE_INTERVAL = 50;
var pause = false;


var currentPhoto2 = 0;
var secondPhoto2 = 1;
var lastPhoto2 = 2;

var currentOpacity2 = new Array();

var FADE_STEP2 = 3;
var FADE_INTERVAL2 = 43;
var pause2 = false;


function fadeInit() {
	if (!document.getElementById("mContainer"))
		return;
	currentOpacity[0]=99;
	for(i=1;i<lastPhoto;i++)currentOpacity[i]=0;
	mHTML="";
	for(i=0;i<lastPhoto;i++)mHTML+='<div id="photo" name="photo" class="mPhoto"><img src="/images/sections/fp' + (i + 1) + '.jpg" width="380" height="482" alt="" border="1"></div>';
	document.getElementById("mContainer").innerHTML = mHTML;

	if(document.all)
		document.getElementsByName("photo")[currentPhoto].style.filter="alpha(opacity=100)";
	else
		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = .99;

	mInterval = setInterval("crossFade()",FADE_INTERVAL);

	startw();

	if (!document.getElementById("mOffer"))
		return;
	currentOpacity2[0]=99;
	for(i=1;i<lastPhoto2;i++)currentOpacity2[i]=0;
	mHTML="";
	for(i=0;i<lastPhoto2;i++) {
		mHTML+='<div id="photo2" name="photo2" class="mPhoto2"><a href="stockists.asp"><img src="/images/sections/stockist' + (i + 1) + '.gif" width="214" height="116" alt="" border="1"></a></div>';
	}
	document.getElementById("mOffer").innerHTML = mHTML;

	if(document.all)
		document.getElementsByName("photo2")[currentPhoto].style.filter="alpha(opacity=100)";
	else
		document.getElementsByName("photo2")[currentPhoto].style.MozOpacity = .99;

	mInterval = setInterval("crossOfferFade()",FADE_INTERVAL2);
}

function crossFade() {
	if (pause) return;

	currentOpacity[currentPhoto] -= FADE_STEP;
	currentOpacity[secondPhoto] += FADE_STEP;

	if(document.all) {
		document.getElementsByName("photo")[currentPhoto].style.filter = "alpha(opacity=" + currentOpacity[currentPhoto] + ")";
		document.getElementsByName("photo")[secondPhoto].style.filter = "alpha(opacity=" + currentOpacity[secondPhoto] + ")";
	} else {
		document.getElementsByName("photo")[currentPhoto].style.MozOpacity = currentOpacity[currentPhoto]/100;
		document.getElementsByName("photo")[secondPhoto].style.MozOpacity =currentOpacity[secondPhoto]/100;
	}

	if(currentOpacity[secondPhoto]/100>=.98) {
		currentPhoto = secondPhoto;
		secondPhoto++;
		if(secondPhoto == lastPhoto) secondPhoto=0;
		pause = true;
		setTimeout("pause=false",2000);
	}
}

function crossOfferFade() {
	if (pause2) return;

	currentOpacity2[currentPhoto2] -= FADE_STEP2;
	currentOpacity2[secondPhoto2] += FADE_STEP2;

	if(document.all) {
		document.getElementsByName("photo2")[currentPhoto2].style.filter = "alpha(opacity=" + currentOpacity2[currentPhoto2] + ")";
		document.getElementsByName("photo2")[secondPhoto2].style.filter = "alpha(opacity=" + currentOpacity2[secondPhoto2] + ")";
	} else {
		document.getElementsByName("photo2")[currentPhoto2].style.MozOpacity = currentOpacity2[currentPhoto2]/100;
		document.getElementsByName("photo2")[secondPhoto2].style.MozOpacity =currentOpacity2[secondPhoto2]/100;
	}

	if(currentOpacity2[secondPhoto2]/100>=.98) {
		currentPhoto2 = secondPhoto2;
		secondPhoto2++;
		if(secondPhoto2 == lastPhoto2) secondPhoto2=0;
		pause2 = true;
		setTimeout("pause2=false",2000);
	}
}

/***********************************
*   http://javascripts.vbarsan.com/
*   This notice may not be removed 
***********************************/

var wwidth=720;
var wheight=20;
var wbcolor="#ccffcc";
var sspeed=4;
var restart=sspeed;
var rspeed=sspeed;

wwholemessage='<nobr class=tab><p><a href="party.asp">Host a Sohni Bridal Party and we\'ll bring our collection to you!</a><img src="/images/_.gif" width="712" height="1" alt=""><a href="contact.asp">All our range can be viewed by arranging a prior appointment.</a></p></nobr>';

var sizeupw=0;var operbr=navigator.userAgent.toLowerCase().indexOf('opera');if(operbr==-1&&navigator.product&&navigator.product=="Gecko"){var agt = navigator.userAgent.toLowerCase();var rvStart = agt.indexOf('rv:');var rvEnd = agt.indexOf(')', rvStart);var check15 = agt.substring(rvStart+3, rvEnd);if(parseFloat(check15)>=1.8) operbr=0;}if (navigator.appVersion.indexOf("Mac")!=-1)operbr=0;
function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}
function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}
function startw(){if(document.getElementById)ns6marqueew(document.getElementById('wslider'));else if(document.all) iemarqueew(wslider);else if(document.layers)ns4marqueew(document.wslider1.document.wslider2);}function iemarqueew(whichdiv){iedivw=eval(whichdiv);iedivw.style.pixelLeft=wwidth;iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=iedivw.offsetWidth;ieslidew();}function ieslidew(){if(iedivw.style.pixelLeft>=sizeupw*(-1)){iedivw.style.pixelLeft-=sspeed;setTimeout("ieslidew()",100);}else{iedivw.style.pixelLeft=wwidth;ieslidew();}}function ns4marqueew(whichlayer){ns4layerw=eval(whichlayer);ns4layerw.left=wwidth;ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>');ns4layerw.document.close();sizeupw=ns4layerw.document.width;ns4slidew();}function ns4slidew(){if(ns4layerw.left>=sizeupw*(-1)){ns4layerw.left-=sspeed;setTimeout("ns4slidew()",100);}else{ns4layerw.left=wwidth;ns4slidew();}}function ns6marqueew(whichdiv){ns6divw=eval(whichdiv);ns6divw.style.left=wwidth;ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=ns6divw.offsetWidth;if(operbr!=-1){operaslider.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=operaslider.offsetWidth;}ns6slidew();}function ns6slidew(){if(parseInt(ns6divw.style.left)>=sizeupw*(-1)){ns6divw.style.left=parseInt(ns6divw.style.left)-sspeed;setTimeout("ns6slidew()",100);}else{ns6divw.style.left=wwidth;ns6slidew();}}
