﻿function change_EngRoomSignBack(iColor, iColorName, bgclrcode, ybgimage){

	prodprintcolor=iColor	//iColorName
	prodmatcolor=ybgimage		//bColorName
	if (currobj.SubCatgId.value.toUpperCase()=='ENGPLASTVALVE' || currobj.SubCatgId.value.toUpperCase()=='VALVEPLASTIC'){
		backgroundimage=backgroundimage.substring(0, backgroundimage.lastIndexOf('_'))
		backgroundimage=backgroundimage+'_'+bgclrcode+'.jpg'
	}else{
		backgroundimage='eng-bg_' + round_(back_height)+'x'+round_(back_width)+'_'+bgclrcode+'.jpg'
	}

	if (backgroundimage.substring(0,5).toLowerCase() == '/xp2/' || backgroundimage.substring(0,5).toLowerCase() == '\\xp2\\'){
		//
	}
	else {
		backgroundimage = '/xp2/clipart/' + backgroundimage	
	}

	currobj.hcolorno1.value = iColor
	currobj.hcolorname1.value = iColorName
	for(i=1; i<num_divs; i++) {
		if (div_color[i] == '1') {
			div_color_hex[i] = "#"+iColor
		}
	}

	if (currobj.SubCatgId.value.toUpperCase()=='ENGNAMEBADGE' || currobj.SubCatgId.value.toUpperCase()=='CORRIDOR' || currobj.SubCatgId.value.toUpperCase()=='CORRIDOR2'){
		yindex=getobjectno(flag_GraphicField)
		if (yindex != -1){
			if (div_text[yindex].toLowerCase()!=='null_25x100.gif'){
				convert_logo_color(yindex, div_text[yindex], 0)
			}
		}
	}
	
	Flash_UpdateFlashObjects();
	
}

function change_EngValveSignBack(iColor, iColorName, bgclrcode){

	prodprintcolor=iColor	//iColorName
	prodmatcolor=bgclrcode		//bColorName

	backgroundimage=backgroundimage.substring(0, backgroundimage.lastIndexOf('_'))
	backgroundimage=backgroundimage+'_'+bgclrcode+'.jpg'

	if (backgroundimage.substring(0,5).toLowerCase() == '/xp2/' || backgroundimage.substring(0,5).toLowerCase() == '\\xp2\\'){
		//
	}
	else {
		backgroundimage = '/xp2/clipart/' + backgroundimage	
	}
	
	currobj.hcolorno1.value = iColor
	currobj.hcolorname1.value = iColorName

	for(i=1; i<num_divs; i++) {
		if (div_color[i] == '1') {
			div_color_hex[i] = "#"+iColor
		}
	}
	
	Flash_UpdateFlashObjects();
	
}

//Create shadow effect for text
shadowflag=false

function change_NameBadgesBack(yColor, yColorName, yBgColorName){

	var xheight = document.preview.templateH.value
	var xwidth = document.preview.templateW.value
	if (xheight == "1.5") {
		xheight = "1"
	}

	backgroundimage="/xp2/clipart/name_badge_" + yBgColorName + "_" + xheight + "x" + xwidth + ".gif"
	
	currobj.hcolorno1.value = yColor
	currobj.hcolorname1.value = yColorName
	for(i=1; i<num_divs; i++) {
		if (div_color[i] == '1') {
			div_color_hex[i] = "#"+yColor
		}
	}

	if (currobj.SubCatgId.value.toUpperCase()=='ENGNAMEBADGE'){
		yindex=getobjectno(flag_GraphicField)
		if (yindex != -1){
			//if (div_text[yindex].toLowerCase()!=='null_25x100.gif'){
				convert_logo_color(yindex, div_text[yindex], 0)
			//}
		}
	}
	
	Flash_UpdateFlashObjects();
	
}


function change_TentSignBg(iColor, iColorName, bgclrcode, ybgimage){
var xdom
	//alert("change_TentSignBg starts")
	
	prodprintcolor=iColor	//iColorName
	prodmatcolor=ybgimage		//bColorName
	if (currobj.SubCatgId.value.toUpperCase()=='TENTSIGN'){
		backgroundimage=backgroundimage.substring(0, backgroundimage.lastIndexOf('_'))
		backgroundimage=backgroundimage+'_'+bgclrcode+'.gif'
		
	}else{
		backgroundimage='tabletop_2x6_'+bgclrcode+'.gif'
	}

	/*
	xdom = getRS(zz_bgnestref, "document", "all", "bkimage")
	if (xdom) {
		if (backgroundimage.substring(0,5).toLowerCase() == '/xp2/' || backgroundimage.substring(0,5).toLowerCase() == '\\xp2\\'){
			xdom.src = backgroundimage
			backgroundimage = backgroundimage	
		}
		else {
			xdom.src = '/xp2/clipart/' + backgroundimage
			backgroundimage = '/xp2/clipart/' + backgroundimage	
		}
	}
    */

	currobj.hcolorno1.value = iColor
	currobj.hcolorname1.value = iColorName
	for(i=1; i<num_divs; i++) {
		if (div_color[i] == '1') {
			div_color_hex[i] = "#"+iColor
		}
	}
	
	Flash_UpdateFlashObjects();
	
	changeengroomsignClipArtImageColorChange(iColor);
}

function changeengroomsignClipArtImageColorChange(pcolor)
{
	//clipart color change work
	// added by vipin for fixing wizard 111102
	yindex=getobjectno(flag_GraphicField);
	if(yindex!=-1)
	{						
		var clipart=div_text[yindex];
			
		//12232010
		//n=clipart.indexOf('_wh')	
		//if(n==-1) {n=clipart.indexOf('_w')}
		n=clipart.indexOf('_wh.')	
		if(n==-1) {n=clipart.indexOf('_w.')}

		if(n>0 && pcolor=="000000")
		{			
			len=clipart.length
			fileext=clipart.substring(len-4, len)
			oldimagecode=clipart.substring(len-7,len-4)			
			clipart=clipart.substring(0,n)+fileext;			
			changeImage(yindex,"pimage"+yindex,clipart,clipart,'',0);
		}
		if(n==-1 && pcolor=="FFFFFF") 
		{			
			n=clipart.indexOf('.')
			len=clipart.length
			fileext=clipart.substring(len-4, len)			
			if(clipart.indexOf('xm_')>0)
			{				
				clipart=clipart.substring(0,n)+'_wh'+fileext;
			}
			else
			{				
				clipart=clipart.substring(0,n)+'_w'+fileext;
			}
			changeImage(yindex,"pimage"+yindex,clipart,clipart,'',0);
		}
	}	
}

//added by vipin 11-02-10 for fixing wizard-111102
function yesSymbol(yindex){
	if (div_hidden[yindex]==true){
		return
	}else{

		if (currobj.signtype.value.toUpperCase() != 'PROJ')	{
			if (flag_Textreduction_logo_insert==true) {
				adjustTextsizes(yindex, '-')
			}
		}else{
			ShowHideBorder(Border_Style);
		}
	}
}

function changeLibSymbol (fn1) {
var yindex, xdom, urlstr, convcolor=false	
	

	yindex=getobjectno(flag_GraphicField)		//"symbol")
	if (yindex==-1) {
		return
	}	
	//If it is facility sign or express sign, convert symbol to printcolor1		
	if(xcatgid=='9' && xsubcatgid=='tentsign')
	{
		clipart='/xp2/clipart/'+fn1;
		changeImage(yindex,"pimage"+yindex,clipart,clipart,'',0);
		//alert(currobj.hcolorno1.value);		
		changeengroomsignClipArtImageColorChange(currobj.hcolorno1.value)
		//if(currobj.hcolorno1.value=='000000') {
		//changeengroomsignClipArtImageColorChange('000000');}
	}
	else
	{
		if (currobj.hcolorno1.value == 'FFFFFF') { currobj.hcolorno1.value = 'FFFFFE'; }
		GenAppendString()
		xchangecolor=currobj.hcolorno1.value
		if (xchangecolor.toUpperCase()=='FFFFFF'){
			xtranscolor=currobj.hcolorno1.value
			xchangecolor=currobj.hcolorno2.value
		}
	
		div_transcolor[yindex]=xtranscolor; div_imagecolor[yindex]=xchangecolor
	
		urlstr='ConvertLogo.asp?imagenum='+yindex + '&fname='+fn1+'&grayscale=true&transcolor='+xtranscolor+'&changecolor='+xchangecolor+'&appendstr='+xappendstr
		urlstr=	urlstr + '&facilityexpr=1'
		//102307imageSelector = window.open(urlstr, 'hidden2', 'width=100,height=100,location=no,resizable=yes,scrollbars=yes,left=3000,top=3000')
	
		var resptext=CallPage('/xp5/' + urlstr + '&xmlhttp=1')
		
		applyConvertedLogo(resptext)
	}
	if (div_hidden[yindex]==true){
		div_hidden[yindex]=false
		xdom = getRS(zz_bgnestref, zz_document, zz_all, joinParam(zz_div, yindex), zz_style)
		if (xdom){
			showtheobject(xdom)
		}
	}	
}

