var prevImage="dummy";
var prevButton;
var prevRow="0_comment";
var flag = "true";
var img;
var prevImgPath;
var internalPrevImg ="";
var check;
function toggleVisibility(theImage) {

	var pathToImages = "../images/products/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "pdt_dts_arrow_select_icon.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "pdt_dts_arrow_active_icon.gif";
    }
}
function ec_toggleVisibility(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_btn.jpg";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_btn.jpg";
    }
}

/* Internal Pages Toggle Script For Left Nagivation for Normal Arrow Images */
function ec_toggleVisibility_int_normal(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_int_close_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_int_open_btn.gif";
    }
}
/* Internal Pages Toggle Script For Left Nagivation for Normal Arrow Images Ends Here */

/* Homepage Toggle Script For Left Nagivation for Different Coloured Arrow Images */
function ec_homtoggleVisibility(theImage) {

	var pathToImages = "../images/home/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_hom_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_hom_btn.gif";
    }
}


function ec_ckgtoggleVisibility(theImage) {
	var pathToImages = "../images/home/";
	var theImageName = theImage.id;
	if (prevImage != theImageName)
	{
		if (prevImage != null && prevButton != null)
	{
		prevRow.style.display="none";
        prevImgPath.src = pathToImages + "ec_hom_arw_open_ckg_btn.gif";
	}
	prevImage = theImageName;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var img = document.getElementById(theImageName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_ckg_btn.gif";
    } else {
		var theRow = document.getElementById(theRowName);
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_ckg_btn.gif";
    }
	prevRow = theRow;
	prevImgPath = img;
	prevButton = theImage.src;
	} else {
		if (prevRow.style.display == "none")
		{
			prevRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_dsg_btn.gif";
		} else {
			prevRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		}
		
	}
}

function ec_dsgtoggleVisibility(theImage) {
	var pathToImages = "../images/home/";
	var theImageName = theImage.id;
		if (prevImage != theImageName)
	{
		if (prevImage != null && prevButton != null)
	{
		prevRow.style.display="none";
        prevImgPath.src = pathToImages + "ec_hom_arw_open_ckg_btn.gif";
	}
	if (flag == "true")
	{
		var rowId = "0_comment";
		var imageId = "0_image";
		var row = document.getElementById(rowId);
		var temp = document.getElementById(imageId);
		row.style.display="none";
		temp.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		flag = false;
	}
	prevImage = theImageName;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var img = document.getElementById(theImageName);
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_dsg_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
    }
	prevRow = theRow;
	prevImgPath = img;
	prevButton = theImage.src;
	} else {
		if (prevRow.style.display == "none")
		{
			prevRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_dsg_btn.gif";
		} else {
			prevRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		}
		
	}
	
}

function ec_clgtoggleVisibility(theImage) {
	var pathToImages = "../images/home/";
	var theImageName = theImage.id;
	if (prevImage != theImageName)
	{
		if (prevImage != null && prevButton != null)
	{
		prevRow.style.display="none";
        prevImgPath.src = pathToImages + "ec_hom_arw_open_ckg_btn.gif";
	}
	if (flag == "true")
	{
		var rowId = "0_comment"
		var imageId = "0_image"
		var row = document.getElementById(rowId);
		var temp = document.getElementById(imageId)
		row.style.display="none";
		temp.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		flag = false;
	}
	var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var img = document.getElementById(theImageName);
    prevImage = theImageName;
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_clg_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_clg_btn.gif";
    }
	prevRow = theRow;
	prevImgPath = img;
	prevButton = theImage.src;
	}else {
		if (prevRow.style.display == "none")
		{
			prevRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_dsg_btn.gif";
		} else {
			prevRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		}
		
	}
}

function ec_fbctoggleVisibility(theImage) {
	var pathToImages = "../images/home/";
	var theImageName = theImage.id;
	if (prevImage != theImageName)
	{
		if (prevImage != null && prevButton != null)
	{
		prevRow.style.display="none";
        prevImgPath.src = pathToImages + "ec_hom_arw_open_ckg_btn.gif";
	}
	if (flag == "true")
	{
		var rowId = "0_comment";
		var imageId = "0_image";
		var row = document.getElementById(rowId);
		var temp = document.getElementById(imageId)
		row.style.display="none";
		temp.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		flag = false;
	}
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	img = document.getElementById(theImageName);
    prevImage = theImageName;
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_fbc_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_fbc_btn.gif";
    }
	prevRow = theRow;
	prevImgPath = img;
	prevButton = theImage.src;
	}else {
		if (prevRow.style.display == "none")
		{
			prevRow.style.display = "";
        theImage.src = pathToImages + "ec_hom_arw_close_dsg_btn.gif";
		} else {
			prevRow.style.display = "none";
        theImage.src = pathToImages + "ec_hom_arw_open_dsg_btn.gif";
		}
		
	}
}
/* Homepage Toggle Script For Left Nagivation for Different Coloured Arrow Images */

/* Internal Pages Toggle Script For Left Nagivation for Different Coloured Arrow Images */
function ec_homtoggleVisibility_internal(theImage) {
if (prevImage != 'undefined' && prevImage != null && prevButton != null)
	{
		prevRow.style.display="none";
        prevImage.src = prevButton;
	}
	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
	if (prevImage != theImageName)
	{
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    prevImage = theImageName;
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_hom_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_hom_btn.gif";
    }
	prevRow = theRow;
	prevButton = theImage.src;
	}
}


function ec_ckgtoggleVisibility_internal(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    var ckgImage = "0_image";
	var ckgComment = "0_comment";
	var dsgImage = "1_image";
	var dsgComment = "1_comment";
	var clgImage = "2_image";
	var clgComment = "2_comment";
	var fbcImage = "3_image";
	var fbcComment = "3_comment";
	var thedsgImage = document.getElementById(dsgImage);
	var theclgImage = document.getElementById(clgImage);
	var thefbcImage = document.getElementById(fbcImage);
	var thedsgComment = document.getElementById(dsgComment);
	var theclgComment = document.getElementById(clgComment);
	var thefbcComment = document.getElementById(fbcComment);
	thefbcComment.style.display = "none";
	thedsgComment.style.display = "none";
	theclgComment.style.display = "none";
	thefbcImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	thedsgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	theclgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_ckg_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
    }
}

function ec_dsgtoggleVisibility_internal(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var ckgImage = "0_image";
	var ckgComment = "0_comment";
	var dsgImage = "1_image";
	var dsgComment = "1_comment";
	var clgImage = "2_image";
	var clgComment = "2_comment";
	var fbcImage = "3_image";
	var fbcComment = "3_comment";
	var theckgImage = document.getElementById(ckgImage);
	var theclgImage = document.getElementById(clgImage);
	var thefbcImage = document.getElementById(fbcImage);
	var theckgComment = document.getElementById(ckgComment);
	var theclgComment = document.getElementById(clgComment);
	var thefbcComment = document.getElementById(fbcComment);
	theckgComment.style.display = "none";
	theclgComment.style.display = "none";
	thefbcComment.style.display = "none";
	theckgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	thefbcImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	theclgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_dsg_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_dsg_btn.gif";
    }
}

function ec_clgtoggleVisibility_internal(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var ckgImage = "0_image";
	var ckgComment = "0_comment";
	var dsgImage = "1_image";
	var dsgComment = "1_comment";
	var clgImage = "2_image";
	var clgComment = "2_comment";
	var fbcImage = "3_image";
	var fbcComment = "3_comment";
	var theckgImage = document.getElementById(ckgImage);
	var thedsgImage = document.getElementById(dsgImage);
	var thefbcImage = document.getElementById(fbcImage);
	var theckgComment = document.getElementById(ckgComment);
	var thedsgComment = document.getElementById(dsgComment);
	var thefbcComment = document.getElementById(fbcComment);
	theckgComment.style.display = "none";
	thedsgComment.style.display = "none";
	thefbcComment.style.display = "none";
	theckgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	thedsgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	thefbcImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_clg_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_clg_btn.gif";
    }
}

function ec_fbctoggleVisibility_internal(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
	var ckgImage = "0_image";
	var ckgComment = "0_comment";
	var dsgImage = "1_image";
	var dsgComment = "1_comment";
	var clgImage = "2_image";
	var clgComment = "2_comment";
	var fbcImage = "3_image";
	var fbcComment = "3_comment";
	var theckgImage = document.getElementById(ckgImage);
	var thedsgImage = document.getElementById(dsgImage);
	var theclgImage = document.getElementById(clgImage);
	var theckgComment = document.getElementById(ckgComment);
	var thedsgComment = document.getElementById(dsgComment);
	var theclgComment = document.getElementById(clgComment);
	theckgComment.style.display = "none";
	thedsgComment.style.display = "none";
	theclgComment.style.display = "none";
	theckgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	thedsgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
	theclgImage.src = pathToImages + "ec_srv_arw_open_ckg_btn.gif";
    
    if (theRow.style.display=="none") {
        theRow.style.display = "";
        theImage.src = pathToImages + "ec_srv_arw_close_fbc_btn.gif";
    } else {
        theRow.style.display = "none";
        theImage.src = pathToImages + "ec_srv_arw_open_fbc_btn.gif";
    }
}
/* Internal Pages Toggle Script For Left Nagivation for Different Coloured Arrow Images */

function ec_open(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display=="none") {
        theRow.style.display = "block";
        //theImage.src = pathToImages + "ec_srv_arw_open_btn.png";
    } 
}

function ec_close(theImage) {

	var pathToImages = "../images/srv/";
	var theImageName = theImage.id;
    var theRowName = theImageName.replace('_image', '_comment');
    var theRow = document.getElementById(theRowName);
    
    if (theRow.style.display!="none") {
        theRow.style.display = "none";
        //theImage.src = pathToImages + "ec_srv_arw_open_btn.png";
    } 
}

function checkCompareCount(form){
	if(form.products.length > 0){
		var checkedCount = 0;
		for(var i=0;i<form.products.length;i++){
			if(form.products[i].checked){
				checkedCount++;
			}
		}
		if(checkedCount > 1 && checkedCount < 5){
			form.submit();
		}else{
			alert("Please select minimum 2 and maximum 4 products for comparing");
		}
	}
	return false;
}

function showModel(path,direction){
	//alert("===========>>>>>>>>>>>>>1"+path);
    var theCell = document.getElementById("product_picture");
	if(path == '' && direction == -1){
		if(currentIndex == -1){
			currentIndex = EffPics.length-1;
		}else{
			currentIndex = (currentIndex+EffPics.length-1)%EffPics.length;
		}
		path = EffPics[currentIndex];
	}else if(path == '' && direction == 1){
		if(currentIndex == -1){
			currentIndex = 0;
		}else{
			currentIndex = (currentIndex+1)%EffPics.length;
		}
		path = EffPics[currentIndex];
		//alert("===========>>>>>>>>>>>>>2"+path);
	}
	theCell.src = "/thumb" +path + "?sizeh=335&sizew=382";
	//alert("===========>>>>>>>>>>>>>3"+theCell.src);

}

function showModelColour(path){
    var theCell = document.getElementById("product_picture");
	theCell.src = "/thumb" +path + "?sizeh=335&sizew=382";	
}

function showZoom(path){
    var theCell = document.getElementById("product_picture");

var a=window.open (theCell.src,"imagepopup","left=300,top=150,menubar=0,resizable=1,width=400,height=400"); 
	
//	theCell.src = path;	
}
