function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		if (i>10){
			setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
			timer++;
		}
	}
	
}

function swapPort(image_load){
	//tag_title = document.getElementById("portDescTitle");
	//tag_url = document.getElementById("portDescURL");
	tag_image_holder = document.getElementById("portHolder")
	//tag_image_holder.style.marginLeft = x_off;
	//tag_title.innerHTML = "<strong>Client : </strong>" + text1;
	//tag_url.innerHTML = "<strong>Link : </strong><a href=http://" + text2 + " target=_blank>"+text2+"</a>";
	
	blendimage('portMainHolder','portMainImg',image_load,'1500');
}

function swapPortNext(file){
	/*image_src = document.portMainImg.src
	image_arr = image_src.split("/");
	image_src = ""
	for(i=0;i<image_arr.length - 1;i++){
		image_src = image_src + image_arr[i] + "/"
	}
	image_file = image_arr[image_arr.length -1];
	image_arr = image_file.split('.')
	image_num = image_arr[0]
	if (image_num < total){
		image_num++;
	}*/
	
	//alert(file)
	
	//alink = document.getElementById('imageZoom');
	//alink.href = "imageLarger.asp?file=" + file;
	
	image_str = file;
	
	blendimage('portMainHolder','portMainImg',image_str,'2200');
}

function swapPortLast(file){
	/*image_src = document.portMainImg.src
	image_arr = image_src.split("/");
	image_src = ""
	for(i=0;i<image_arr.length - 1;i++){
		image_src = image_src + image_arr[i] + "/"
	}
	image_file = image_arr[image_arr.length -1];
	image_arr = image_file.split('.')
	image_num = image_arr[0]
	if (image_num > 1){
		image_num--;
	}*/
	
	//alert(file)
	
	image_str = file
	
	blendimage('portMainHolder','portMainImg',image_str,'1000');
}

function checkBox(ind){
	for(i=1;i<=ind;i++){			
		if(i==4)
		{
			if ((document.form1['textfield'+i].value!="") && ((document.form1['textfield'+i].value.indexOf('@')==-1) || (document.form1['textfield'+i].value.indexOf('.')==-1)))
			{
				showTick(i,'0');
				document.form1['textfield'+i].style.backgroundColor = '#FFC1C1'
				
			}
			else
			{
				showTick(i,'1');
				document.form1['textfield'+i].style.backgroundColor = '#D5FFD5'
			}
		}
		else if(i==7 || i == 8)
		{
			
			if (document.form1['textfield'+i].options[document.form1['textfield'+i].selectedIndex].value==0)
			{
				showTick(i,'0');
				document.form1['textfield'+i].style.backgroundColor = '#FFC1C1'
				
			}
			else
			{
				showTick(i,'1');
				document.form1['textfield'+i].style.backgroundColor = '#D5FFD5'
			}
		}
		else if(i==10)
		{
			alert(document.form1['textfield'+i].value)
			if (document.form1['textfield'+i].value==0)
			{
				showTick(i,'0');
				document.form1['textfield'+i].style.backgroundColor = '#FFC1C1'
				
			}
			else
			{
				showTick(i,'1');
				document.form1['textfield'+i].style.backgroundColor = '#D5FFD5'
			}
		}
		else
		{
			
			
			if (document.form1['textfield'+i].value=="")
			{
				showTick(i,'0');
				document.form1['textfield'+i].style.backgroundColor = '#FFC1C1'
				
			}
			else
			{
				showTick(i,'1');
				document.form1['textfield'+i].style.backgroundColor = '#D5FFD5'
			}
		}
	}
}


function showTick(source, status){
	
	ns4 = false;
	
	if (document.layers) 
	{ ns4 = true } //NS4
	
	if (document.all) //MS4
	{ ms4 = true } 
	
	if (document.getElementByID && document.all)//IE5
	{ 
		IE = true;
		ie5= true;
	} 
	
	if (document.getElementByID && !document.all)//NS6
	{ ns6=true} 
	
	if (document.getElementByID)//IE5+ and NS6+
	{ 
		IE = true;
		ie5 = true;
		ns6 = true;
	} 
	
	if (ns4) {
		var elem = getObjNN4(document, target);
		alert("hit1")
	} else {
		if(document.getElementById) {
			var elem = document.getElementById('tick'+source);
			if (status=='1'){
				elem.className = 'noinv_tick'
				elem.src = "images/tick1.jpg"
			}
			else{
				elem.className = 'noinv_tick'
				elem.src = "images/tick2.jpg"
			}
		} else if (document.all){
			var elem = document.all[target];
			alert("hit3")
		}
	} 
	
}